From 84533dc9efeb99f7d3c8943f169df2814cc16998 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 9 May 2024 13:51:39 +0300 Subject: [PATCH] Fix notifications in etctree --- etctree.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etctree.js b/etctree.js index f385fb7..05da936 100644 --- a/etctree.js +++ b/etctree.js @@ -269,10 +269,10 @@ class EtcTree { cur_old.value = cur_new.value; const key_watchers = (cur_old.key_watchers ? [ ...watchers, ...(cur_old.key_watchers||[]) ] : watchers); - const notify = { watchers: key_watchers, key, value: cur_old.value, mod_revision: cur_old.mod_revision }; - if (cur_old.lease) + const notify = { watchers: key_watchers, key, value: cur_new.value, mod_revision: cur_new.mod_revision }; + if (cur_new.lease) { - notify.lease = cur_old.lease; + notify.lease = cur_new.lease; } notifications.push(notify); } @@ -498,7 +498,7 @@ class EtcTree } else { - this._put({ key: ev.key, value: ev.value }, ev.mod_revision, notifications); + this._put({ key: ev.key, value: ev.value, lease: ev.lease }, ev.mod_revision, notifications); } } }