fix(subs): establish lock to prevent race condition

This commit is contained in:
SabreCat
2022-11-01 20:47:21 -05:00
parent a2d5211b00
commit aea0be3245
18 changed files with 1146 additions and 720 deletions

View File

@@ -431,6 +431,8 @@ export default new Schema({
lastCron: { $type: Date, default: Date.now },
_cronSignature: { $type: String, default: 'NOT_RUNNING' }, // Private property used to avoid double cron
// Lock property to avoid double subscription. Not strictly private because we query on it
_subSignature: { $type: String, default: 'NOT_RUNNING' },
// {GROUP_ID: Boolean}, represents whether they have unseen chat messages
newMessages: {