forked from medusajs/medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(locking): Locking module (medusajs#9524)
**What** - Locking Module to manage concurrency - Default `in-memory` provider
- Loading branch information
1 parent
5c9e289
commit c8b375a
Showing
28 changed files
with
806 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ www/**/.yarn/* | |
.idea | ||
.turbo | ||
build/** | ||
dist/** | ||
**/dist | ||
**/stats | ||
.favorites.json | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Context } from "../shared-context" | ||
|
||
export interface ILockingProvider { | ||
execute<T>( | ||
keys: string | string[], | ||
job: () => Promise<T>, | ||
args?: { | ||
timeout?: number | ||
}, | ||
sharedContext?: Context | ||
): Promise<T> | ||
acquire( | ||
keys: string | string[], | ||
args?: { | ||
ownerId?: string | null | ||
expire?: number | ||
}, | ||
sharedContext?: Context | ||
): Promise<void> | ||
release( | ||
keys: string | string[], | ||
args?: { | ||
ownerId?: string | null | ||
}, | ||
sharedContext?: Context | ||
): Promise<boolean> | ||
releaseAll( | ||
args?: { | ||
ownerId?: string | null | ||
}, | ||
sharedContext?: Context | ||
): Promise<void> | ||
} | ||
|
||
export interface ILockingModule { | ||
execute<T>( | ||
keys: string | string[], | ||
job: () => Promise<T>, | ||
args?: { | ||
timeout?: number | ||
provider?: string | ||
}, | ||
sharedContext?: Context | ||
): Promise<T> | ||
acquire( | ||
keys: string | string[], | ||
args?: { | ||
ownerId?: string | null | ||
expire?: number | ||
provider?: string | ||
}, | ||
sharedContext?: Context | ||
): Promise<void> | ||
release( | ||
keys: string | string[], | ||
args?: { | ||
ownerId?: string | null | ||
provider?: string | ||
}, | ||
sharedContext?: Context | ||
): Promise<boolean> | ||
releaseAll( | ||
args?: { | ||
ownerId?: string | null | ||
provider?: string | ||
}, | ||
sharedContext?: Context | ||
): Promise<void> | ||
} |
Oops, something went wrong.