Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Bug: Concurrency is broken in Schedule #922

Open
1 of 2 tasks
kyranet opened this issue Feb 12, 2020 · 0 comments
Open
1 of 2 tasks

Bug: Concurrency is broken in Schedule #922

kyranet opened this issue Feb 12, 2020 · 0 comments
Labels
Mod: SettingsGateway Issues and PRs related to SettingsGateway. Priority: High Issues that must be fixed or PRs that must be finished and merged with high priority.

Comments

@kyranet
Copy link
Contributor

kyranet commented Feb 12, 2020

Describe the issue

If you have 10 tasks and they all end at nearly the same time, chances are 100% that they all will read the state before being updated by the other writes, meaning that the last to write to DB will restore the other 9. Thanks @gc for noticing this bug.

Code or steps to reproduce

  • Create a synchronous task.
  • Create 10 scheduled tasks for it.
  • Wait until the 10th finished.
  • You'll have the internal cache empty, but the DB will report 9 objects in schedule.

Expected and actual behavior

It should do either sequentially or in a burst (using @klasa/request-handler to do an individual update then one update containing 9 changes).

Further details

  • discord.js version: fe7df708e44e0280dfaf0f8e457b154781bb5140
  • node.js version: 12.15.0
  • Klasa version: 0.5.0-dev
  • I have modified core files.
  • I have tested the issue on latest master. Commit hash: 42fdd6d4b8ec1596e26f21e03a415de179b816ba
@kyranet kyranet added Priority: High Issues that must be fixed or PRs that must be finished and merged with high priority. Mod: SettingsGateway Issues and PRs related to SettingsGateway. labels Feb 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Mod: SettingsGateway Issues and PRs related to SettingsGateway. Priority: High Issues that must be fixed or PRs that must be finished and merged with high priority.
Projects
None yet
Development

No branches or pull requests

1 participant