add a FIXME note for a sketchy implementation in history keeper

This commit is contained in:
ansuz 2020-05-04 15:46:08 -04:00
parent c9846e532b
commit 4037270a23

View file

@ -836,6 +836,9 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
if (isCp) {
// id becomes either null or an array or results...
id = CHECKPOINT_PATTERN.exec(msgStruct[4]);
// FIXME relying on this data to be stored on an in-memory structure
// managed by a dependency is fragile. We should put this somewhere
// more straightforward and reliable.
if (Array.isArray(id) && id[2] && id[2] === channel.lastSavedCp) {
// Reject duplicate checkpoints
return;
@ -901,6 +904,8 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
// FIXME
if (Array.isArray(id) && id[2]) {
// Store new checkpoint hash
// there's a FIXME above which concerns a reference to `lastSavedCp`
// this is a hacky place to store important data.
channel.lastSavedCp = id[2];
}
}