From 3092907e5e5d38caeeda15a83ea11e0462022f41 Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Thu, 21 Dec 2023 16:19:52 -0300 Subject: [PATCH] fix(spell): update spell api (#315) --- aqua-tests/fluence.yaml | 4 ++-- aqua-tests/spell/spell.aqua | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/aqua-tests/fluence.yaml b/aqua-tests/fluence.yaml index fbf32ca..69f159e 100644 --- a/aqua-tests/fluence.yaml +++ b/aqua-tests/fluence.yaml @@ -13,6 +13,6 @@ dependencies: marine: 0.14.1 mrepl: 0.21.3 npm: - '@fluencelabs/aqua-lib': 0.8.1 - '@fluencelabs/spell': 0.5.33 + '@fluencelabs/aqua-lib': 0.9.0 + '@fluencelabs/spell': 0.6.0 '@fluencelabs/trust-graph': 3.1.2 diff --git a/aqua-tests/spell/spell.aqua b/aqua-tests/spell/spell.aqua index e9f6a34..ee61417 100644 --- a/aqua-tests/spell/spell.aqua +++ b/aqua-tests/spell/spell.aqua @@ -56,16 +56,15 @@ func spell(config: SpellConfig): check_and_run = (key: string, now:u32, interval: u32, job: u32 -> ()): last_run <- Spell.get_u32(key) - need_to_run = !last_run.success || ((now - last_run.num) >= interval) + need_to_run = !last_run.success || ((now - last_run.value) >= interval) if need_to_run == true: log(Op.concat_strings(Op.concat_strings("Running ", key), "job")) job(now) Spell.set_u32(key, now) - - + + on HOST_PEER_ID: now <- PeerTimeTrunc.timestamp_sec() check_and_run("clear_expired", now, config.expired_interval, clear_expired) check_and_run("renew", now, config.renew_interval, renew) check_and_run("replicate", now, config.replicate_interval, replicate) -