Fix concurrent local KV increments and maximum updates 馃馃馃 - #28194
Open
jashkarangiya wants to merge 2 commits into
Open
jashkarangiya wants to merge 2 commits into
jashkarangiya wants to merge 2 commits into
Conversation
This was referenced Sep 8, 2026
Nitwel
requested changes
Sep 10, 2026
Nitwel
left a comment
Member
There was a problem hiding this comment.
After discussing it with @ComfortablyCoding and @br41nslug, we should update the Kv interface to support MaybePromises via type MaybePromise<T> = Promise<T> | T. And then make all the async functions sync in the local implementation.
Contributor
Author
|
Thanks @Nitwel! Updated this in The full memory suite (171 tests), package build, lint, Stylelint, and formatting all pass. Could you take another look when you have a chance? |
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.
What's Changed
increment()andsetMax()by reading synchronously before starting the existing write.Kvinterface to allow synchronous or asynchronous implementations throughMaybePromise<T>return types.KvLocalmethods synchronous while preserving serialization, numeric validation, equal-value rejection, and TTL behavior. The Redis implementation remains asynchronous; no new dependencies were added.@directus/memory.Tested Scenarios
setMax()/increment()calls see the latest value.createKvAPI reproduction passed.pnpm lint,pnpm lint:style,pnpm format, andgit diff --checkpassed. ESLint reported 81 existing warnings outside the changed files, zero errors.Review Notes / Questions / Concerns
setMaxvalues as updates聽#28172's equality-boundary fix. Both operations previously read stale values when their calls overlapped.tsc --noEmit -p packages/memory/tsconfig.jsonreports four existing errors: three overload errors insrc/bus/lib/create.test.tsand one Buffer type error insrc/bus/lib/redis.test.ts. Comparing compiler diagnostics with the unchanged base sources produced the identical four errors and no new diagnostics. These unrelated files are unchanged.Checklist
@directus/specs)@directus/sdk) updated to reflect the changes@directus/types) updated to reflect the changes@directus/system-data) updated for changes to system collections/fields/relationsFixes #28193