mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
feat(kv_queues): increase max queue delay to 30 days (#20626)
This commit is contained in:
parent
15cfb67551
commit
035df85732
2 changed files with 5 additions and 5 deletions
|
@ -1550,9 +1550,9 @@ dbTest("queue nan delay", async (db) => {
|
|||
});
|
||||
|
||||
dbTest("queue large delay", async (db) => {
|
||||
await db.enqueue("test", { delay: 7 * 24 * 60 * 60 * 1000 });
|
||||
await db.enqueue("test", { delay: 30 * 24 * 60 * 60 * 1000 });
|
||||
await assertRejects(async () => {
|
||||
await db.enqueue("test", { delay: 7 * 24 * 60 * 60 * 1000 + 1 });
|
||||
await db.enqueue("test", { delay: 30 * 24 * 60 * 60 * 1000 + 1 });
|
||||
}, TypeError);
|
||||
});
|
||||
|
||||
|
|
|
@ -26,14 +26,14 @@ async function openKv(path: string) {
|
|||
return new Kv(rid, kvSymbol);
|
||||
}
|
||||
|
||||
const millisecondsInOneWeek = 7 * 24 * 60 * 60 * 1000;
|
||||
const maxQueueDelay = 30 * 24 * 60 * 60 * 1000;
|
||||
|
||||
function validateQueueDelay(delay: number) {
|
||||
if (delay < 0) {
|
||||
throw new TypeError("delay cannot be negative");
|
||||
}
|
||||
if (delay > millisecondsInOneWeek) {
|
||||
throw new TypeError("delay cannot be greater than one week");
|
||||
if (delay > maxQueueDelay) {
|
||||
throw new TypeError("delay cannot be greater than 30 days");
|
||||
}
|
||||
if (isNaN(delay)) {
|
||||
throw new TypeError("delay cannot be NaN");
|
||||
|
|
Loading…
Reference in a new issue