Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible completed job state issue #99

Merged
merged 2 commits into from
Nov 10, 2022
Merged

Fix possible completed job state issue #99

merged 2 commits into from
Nov 10, 2022

Conversation

lok52
Copy link
Collaborator

@lok52 lok52 commented Nov 10, 2022

Fix possible concurrency issue (reported by @EvgenKor).

Because job.getState method is asynchronous following scenario is possible:

  1. We get the job from queue by id
  2. We asynchronously get job's state
  3. The state is completed
  4. Job object that we got in the first step does not contain correct returnvalue because it was not in completed state at the moment of fetching.

Solution:
If we got completed job's state, we need to check job's returnvalue and if it is null re-fetch the job.

zp-relayer/endpoints.ts Outdated Show resolved Hide resolved
@EvgenKor EvgenKor self-requested a review November 10, 2022 12:58
@akolotov akolotov merged commit e1bddee into devel Nov 10, 2022
@akolotov akolotov deleted the fix/job-state branch November 10, 2022 18:34
akolotov added a commit that referenced this pull request Nov 21, 2022
This merge contains the following set of changes:
- Reworked approach to resend transactions (#96)
- New job status model, sender consistency check, improved transaction hash tracking (#97)
- Fix possible completed job state issue (#99)
lok52 pushed a commit that referenced this pull request Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants