diff --git a/plugos/lib/datastore.ts b/plugos/lib/datastore.ts index 4af3b6e..076f4eb 100644 --- a/plugos/lib/datastore.ts +++ b/plugos/lib/datastore.ts @@ -23,6 +23,9 @@ export class DataStore { } batchGet(keys: KvKey[]): Promise<(T | null)[]> { + if (keys.length === 0) { + return Promise.resolve([]); + } return this.kv.batchGet(keys); } @@ -31,6 +34,9 @@ export class DataStore { } batchSet(entries: KV[]): Promise { + if (entries.length === 0) { + return Promise.resolve(); + } const allKeyStrings = new Set(); const uniqueEntries: KV[] = []; for (const { key, value } of entries) { @@ -50,6 +56,9 @@ export class DataStore { } batchDelete(keys: KvKey[]): Promise { + if (keys.length === 0) { + return Promise.resolve(); + } return this.kv.batchDelete(keys); }