Repository navigation
Fetch users before giving up on an unknown player in /azlink money - #66
Open
CryLegende wants to merge 1 commit into
Open
CryLegende wants to merge 1 commit into
CryLegende wants to merge 1 commit into
Conversation
A player who joined after the last data fetch is not in the user cache yet, so '/azlink money' failed with 'Unable to find player' for up to a minute after a join. Commands queued for delivery on join (vote rewards...) were lost this way. When the target player is online but unknown, fetch the data and retry once the response is handled. FetcherTask.fetch() now returns the pending request instead of an already completed future when it is called again within five seconds, so callers can wait for its response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/azlink moneyonly looks at the user cache, which is filled by the fetch task once per minute. For up to a minute after a player joins, the command fails withUnable to find player '<name>', please try again in few seconds or use '/azlink fetch'.This hits every plugin that delivers money right after a join, for example rewards queued while the player was offline and run on join. On our server this lost 154 vote rewards in five months, all on the player's first join after a restart. Running
/azlink fetchjust before does not help: it starts the request but does not wait for the response.Changes
/azlink money: when the player is online but not in the cache yet, fetch the data and retry once the response has been handled. Offline players keep the current error message.FetcherTask.fetch(): when called again within five seconds, return the pending request instead of an already completed future, so callers can actually wait for the response.Testing
Paper 26.3 with a local Azuriom site:
/azlink money add <player> 1sent from the console one second after the player joined now printsMoney has been edited successfully.and updates the balance. Before, it printedUnable to find player../gradlew :azlink-common:testpasses.