add a FIXME note for a sketchy implementation in history keeper

pull/1/head
ansuz 5 years ago
parent c9846e532b
commit 4037270a23

@ -836,6 +836,9 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
if (isCp) { if (isCp) {
// id becomes either null or an array or results... // id becomes either null or an array or results...
id = CHECKPOINT_PATTERN.exec(msgStruct[4]); 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) { if (Array.isArray(id) && id[2] && id[2] === channel.lastSavedCp) {
// Reject duplicate checkpoints // Reject duplicate checkpoints
return; return;
@ -901,6 +904,8 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) {
// FIXME // FIXME
if (Array.isArray(id) && id[2]) { if (Array.isArray(id) && id[2]) {
// Store new checkpoint hash // 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]; channel.lastSavedCp = id[2];
} }
} }

Loading…
Cancel
Save