From 42ea8a3f9a49081d65fda05d8d99ed2732aeb6c0 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 13 Jun 2024 19:38:09 -0700 Subject: [PATCH] fix(liveslots): cache.delete() does not return a useful value Liveslots uses an internal `Cache` utility to hold data about virtual objects, backed by the vatstore. PR #8752 included a change to make its `delete()` method return a "did exist" boolean, just like a JavaScript `Map`. Unfortunately the cache does not know whether a key is present/absent in the backing store, so `delete()` will return an erroneous value. It would cost an extra DB query to make this behave as expected, and liveslots does not have a need for it. So this commit reverts that change, and makes `delete()` return void as before. --- packages/swingset-liveslots/src/cache.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/swingset-liveslots/src/cache.js b/packages/swingset-liveslots/src/cache.js index cbc7669ca25..f0129b1ccd4 100644 --- a/packages/swingset-liveslots/src/cache.js +++ b/packages/swingset-liveslots/src/cache.js @@ -17,7 +17,7 @@ import { Fail } from '@agoric/assert'; /** * @callback CacheDelete * @param {string} key - * @returns {boolean} + * @returns {void} * * @callback CacheFlush * @returns {void} @@ -83,9 +83,8 @@ export function makeCache(readBacking, writeBacking, deleteBacking) { }, delete: key => { assert.typeof(key, 'string'); - const result = stash.delete(key); + stash.delete(key); dirtyKeys.add(key); - return result; }, flush: () => { const keys = [...dirtyKeys.keys()];