-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mostly graceful resuming of missed _notifications (when dmt-proc is o…
…ffline) with deduplication
- Loading branch information
Showing
33 changed files
with
805 additions
and
514 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.222 · 2025-01-20 | ||
1.2.231 · 2025-02-03 |
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
1 change: 0 additions & 1 deletion
1
core/node/connectome/node_modules/bufferutil/build/node_gyp_bins/python3
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
core/node/connectome/node_modules/utf-8-validate/build/node_gyp_bins/python3
This file was deleted.
Oops, something went wrong.
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
56 changes: 56 additions & 0 deletions
56
core/node/controller/program/boot/retrogradePushMessagesRecovery.js
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,56 @@ | ||
import { log, dateFns, timeutils, loop, colors, isMainDevice, isMainServer, isDevUser } from 'dmt/common'; | ||
|
||
const { ONE_SECOND, ONE_MINUTE, ONE_HOUR, ONE_DAY } = timeutils; | ||
|
||
const { format } = dateFns; | ||
const INITIAL_DELAY = 3000; | ||
|
||
const MAX_LOOKBACK = ONE_DAY; | ||
|
||
export default function init(program) { | ||
if (!isMainServer()) return; | ||
|
||
setTimeout(() => { | ||
const aliveTimestamp = program.slot('aliveTimestamp').get(); | ||
|
||
if (aliveTimestamp && JSON.stringify(aliveTimestamp) != '{}') { | ||
const aliveDate = new Date(aliveTimestamp); | ||
|
||
log.green( | ||
`${colors.cyan('dmt-proc')} started after being offline for ${colors.cyan(timeutils.prettyTime(aliveTimestamp))} ${colors.gray( | ||
`(since ${aliveDate.toISOString()})` | ||
)}` | ||
); | ||
|
||
aliveDate.setSeconds(0); | ||
aliveDate.setMilliseconds(0); | ||
|
||
const _now = new Date(); | ||
_now.setSeconds(0); | ||
_now.setMilliseconds(0); | ||
|
||
const now = _now.getTime(); | ||
|
||
let timepoint = aliveDate.getTime(); | ||
|
||
if (now - aliveDate.getTime() > MAX_LOOKBACK) { | ||
timepoint = now - MAX_LOOKBACK; | ||
} | ||
|
||
while (timepoint < now) { | ||
if (isDevUser()) { | ||
log.red(`Checking delayed messages at ${colors.white(format(timepoint, 'H:mm:ss'))} ...`); | ||
} | ||
program.simulateNotifiersTimepoint(timepoint); | ||
timepoint += ONE_MINUTE; | ||
} | ||
} | ||
setTimeout(() => { | ||
loop(() => { | ||
if (!program.isStopping()) { | ||
program.slot('aliveTimestamp', { announce: false }).set(Date.now()); | ||
} | ||
}, 2000); | ||
}, 10 * ONE_SECOND); | ||
}, INITIAL_DELAY); | ||
} |
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,15 @@ | ||
import path from 'path'; | ||
|
||
import { dmtStateDir } from 'dmt/common'; | ||
import { SyncStore } from 'dmt/connectome-stores'; | ||
|
||
const store = new SyncStore( | ||
{}, | ||
{ | ||
stateFilePath: path.join(dmtStateDir, 'push_messages_dedup.json') | ||
} | ||
); | ||
|
||
store.slot('pushMessages').makeArray(); | ||
|
||
export { store }; |
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,9 @@ | ||
import { dateFns } from 'dmt/common'; | ||
|
||
const { format } = dateFns; | ||
|
||
export default function getDedupKey(dateTime) { | ||
const dt = new Date(dateTime.getTime()); | ||
dt.setSeconds(0); | ||
return format(dt, 'yyyy-MM-dd H:mm'); | ||
} |
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
Oops, something went wrong.