From f9e150635d1fa26b622908e9c761277501123a27 Mon Sep 17 00:00:00 2001 From: uki00a Date: Sat, 17 Apr 2021 16:09:16 +0900 Subject: [PATCH 1/5] bump: deno@v1.9.0 --- .denov | 2 +- modules-lock.json | 4 ++-- modules.json | 2 +- vendor/https/deno.land/std/async/mod.ts | 2 +- vendor/https/deno.land/std/fmt/colors.ts | 2 +- vendor/https/deno.land/std/io/bufio.ts | 2 +- vendor/https/deno.land/std/testing/asserts.ts | 2 +- vendor/https/deno.land/std/testing/bench.ts | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.denov b/.denov index 57f52717..295e37c0 100644 --- a/.denov +++ b/.denov @@ -1 +1 @@ -v1.8.2 +v1.9.0 diff --git a/modules-lock.json b/modules-lock.json index 0d6805b1..2b6e10df 100644 --- a/modules-lock.json +++ b/modules-lock.json @@ -1,6 +1,6 @@ { "https://deno.land/std": { - "version": "@0.91.0", + "version": "@0.93.0", "modules": [ "/async/mod.ts", "/testing/bench.ts", @@ -9,4 +9,4 @@ "/fmt/colors.ts" ] } -} +} \ No newline at end of file diff --git a/modules.json b/modules.json index 0d6805b1..0ebe7023 100644 --- a/modules.json +++ b/modules.json @@ -1,6 +1,6 @@ { "https://deno.land/std": { - "version": "@0.91.0", + "version": "@0.93.0", "modules": [ "/async/mod.ts", "/testing/bench.ts", diff --git a/vendor/https/deno.land/std/async/mod.ts b/vendor/https/deno.land/std/async/mod.ts index 6abab2dd..a1de8dba 100644 --- a/vendor/https/deno.land/std/async/mod.ts +++ b/vendor/https/deno.land/std/async/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.91.0/async/mod.ts"; +export * from "https://deno.land/std@0.93.0/async/mod.ts"; diff --git a/vendor/https/deno.land/std/fmt/colors.ts b/vendor/https/deno.land/std/fmt/colors.ts index d15e392f..4ef442b5 100644 --- a/vendor/https/deno.land/std/fmt/colors.ts +++ b/vendor/https/deno.land/std/fmt/colors.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.91.0/fmt/colors.ts"; +export * from "https://deno.land/std@0.93.0/fmt/colors.ts"; diff --git a/vendor/https/deno.land/std/io/bufio.ts b/vendor/https/deno.land/std/io/bufio.ts index f1e17d5e..4c927156 100644 --- a/vendor/https/deno.land/std/io/bufio.ts +++ b/vendor/https/deno.land/std/io/bufio.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.91.0/io/bufio.ts"; +export * from "https://deno.land/std@0.93.0/io/bufio.ts"; diff --git a/vendor/https/deno.land/std/testing/asserts.ts b/vendor/https/deno.land/std/testing/asserts.ts index dc3dd589..40fc6ee2 100644 --- a/vendor/https/deno.land/std/testing/asserts.ts +++ b/vendor/https/deno.land/std/testing/asserts.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.91.0/testing/asserts.ts"; +export * from "https://deno.land/std@0.93.0/testing/asserts.ts"; diff --git a/vendor/https/deno.land/std/testing/bench.ts b/vendor/https/deno.land/std/testing/bench.ts index 13de39f4..ba57552d 100644 --- a/vendor/https/deno.land/std/testing/bench.ts +++ b/vendor/https/deno.land/std/testing/bench.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.91.0/testing/bench.ts"; +export * from "https://deno.land/std@0.93.0/testing/bench.ts"; From a72e3dac16979ddc447ae6ea43acefea45bfcd02 Mon Sep 17 00:00:00 2001 From: uki00a Date: Sat, 17 Apr 2021 16:12:30 +0900 Subject: [PATCH 2/5] chore: Format modules-lock.json --- modules-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules-lock.json b/modules-lock.json index 2b6e10df..0ebe7023 100644 --- a/modules-lock.json +++ b/modules-lock.json @@ -9,4 +9,4 @@ "/fmt/colors.ts" ] } -} \ No newline at end of file +} From dfcd682d693f26b69bd7210cc791d3196c999f4f Mon Sep 17 00:00:00 2001 From: uki00a Date: Sat, 17 Apr 2021 16:24:27 +0900 Subject: [PATCH 3/5] fix: Use std/io/buffer instead of Deno.Buffer --- modules-lock.json | 1 + modules.json | 1 + protocol/reply.ts | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules-lock.json b/modules-lock.json index 0ebe7023..06b2b91b 100644 --- a/modules-lock.json +++ b/modules-lock.json @@ -5,6 +5,7 @@ "/async/mod.ts", "/testing/bench.ts", "/testing/asserts.ts", + "/io/buffer.ts", "/io/bufio.ts", "/fmt/colors.ts" ] diff --git a/modules.json b/modules.json index 0ebe7023..06b2b91b 100644 --- a/modules.json +++ b/modules.json @@ -5,6 +5,7 @@ "/async/mod.ts", "/testing/bench.ts", "/testing/asserts.ts", + "/io/buffer.ts", "/io/bufio.ts", "/fmt/colors.ts" ] diff --git a/protocol/reply.ts b/protocol/reply.ts index 70f614d9..aefe85a9 100644 --- a/protocol/reply.ts +++ b/protocol/reply.ts @@ -1,4 +1,5 @@ import { BufReader } from "../vendor/https/deno.land/std/io/bufio.ts"; +import { Buffer } from "../vendor/https/deno.land/std/io/buffer.ts"; import type * as types from "./types.ts"; import { EOFError, ErrorReplyError, InvalidStateError } from "../errors.ts"; import { decoder } from "./_util.ts"; @@ -218,7 +219,7 @@ async function readLine(reader: BufReader): Promise { if (d1 === "\n".charCodeAt(0)) { buf[loc++] = d; buf[loc++] = d1; - return decoder.decode(new Deno.Buffer(buf.subarray(0, loc)).bytes()); + return decoder.decode(new Buffer(buf.subarray(0, loc)).bytes()); } } buf[loc++] = d; From 21e39ce28bbc3be686f2322267a7ae64fe5c4c97 Mon Sep 17 00:00:00 2001 From: uki00a Date: Sat, 17 Apr 2021 16:50:06 +0900 Subject: [PATCH 4/5] fix: Fix lint errors --- .github/workflows/build.yml | 4 ++-- connection.ts | 10 +++++----- modules-lock.json | 1 + modules.json | 1 + redis.ts | 5 +---- tests/acl_test.ts | 2 +- tests/connection_test.ts | 3 +-- tests/executor_test.ts | 8 ++------ tests/general_test.ts | 1 - tests/script_test.ts | 2 -- tests/stream_test.ts | 2 +- tools/make_mod.ts | 8 +++++--- 12 files changed, 20 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f31643ff..2f2784f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,8 +39,8 @@ jobs: - name: Run lint run: | - deno fmt --check - deno lint --unstable + deno fmt --check --ignore=./benchmark/node_modules + deno lint --unstable --ignore=./benchmark/node_modules - name: Set up Redis ${{ matrix.redis }} uses: shogo82148/actions-setup-redis@v1 diff --git a/connection.ts b/connection.ts index 93640291..4ba2a3a5 100644 --- a/connection.ts +++ b/connection.ts @@ -140,13 +140,13 @@ export class RedisConnection implements Connection { try { await sendCommand(this.writer, this.reader, "PING"); this._isConnected = true; - } catch (error) { + } catch (_error) { // TODO: Maybe we should log this error. this._isConnected = false; return new Promise((resolve, reject) => { - const interval = setInterval(async () => { + const _interval = setInterval(async () => { if (this.retryCount > this.maxRetryCount) { this.close(); - clearInterval(interval); + clearInterval(_interval); reject(new Error("Could not reconnect")); } try { @@ -155,9 +155,9 @@ export class RedisConnection implements Connection { await sendCommand(this.writer, this.reader, "PING"); this._isConnected = true; this.retryCount = 0; - clearInterval(interval); + clearInterval(_interval); resolve(); - } catch (err) { + } catch (_err) { // retrying } finally { this.retryCount++; diff --git a/modules-lock.json b/modules-lock.json index 06b2b91b..4b773512 100644 --- a/modules-lock.json +++ b/modules-lock.json @@ -7,6 +7,7 @@ "/testing/asserts.ts", "/io/buffer.ts", "/io/bufio.ts", + "/io/util.ts", "/fmt/colors.ts" ] } diff --git a/modules.json b/modules.json index 06b2b91b..4b773512 100644 --- a/modules.json +++ b/modules.json @@ -7,6 +7,7 @@ "/testing/asserts.ts", "/io/buffer.ts", "/io/bufio.ts", + "/io/util.ts", "/fmt/colors.ts" ] } diff --git a/redis.ts b/redis.ts index 84f4e77e..9b4d42c7 100644 --- a/redis.ts +++ b/redis.ts @@ -45,7 +45,6 @@ import type { RedisConnectionOptions } from "./connection.ts"; import { CommandExecutor, MuxExecutor } from "./executor.ts"; import { unwrapReply } from "./protocol/mod.ts"; import type { - ArrayReply, Binary, Bulk, BulkNil, @@ -53,11 +52,9 @@ import type { BulkString, ConditionalArray, Integer, - IntegerReply, Raw, RedisValue, SimpleString, - SimpleStringReply, } from "./protocol/mod.ts"; import { createRedisPipeline } from "./pipeline.ts"; import { psubscribe, subscribe } from "./pubsub.ts"; @@ -1465,7 +1462,7 @@ export class RedisImpl implements Redis { args.push("MINMATCHLEN"); args.push(opts.minmatchlen); } - return this.execBulkReply("STRALGO", "LCS", target, a, b, ...args); + return this.execBulkReply("STRALGO", algorithm, target, a, b, ...args); } strlen(key: string) { diff --git a/tests/acl_test.ts b/tests/acl_test.ts index 2cb2455d..bde28f07 100644 --- a/tests/acl_test.ts +++ b/tests/acl_test.ts @@ -133,7 +133,7 @@ suite.test("log", async () => { const randString = "balh"; try { await client.auth(randString, randString); - } catch (error) { + } catch (_error) { // skip invalid username-password pair error } assertEquals((await client.aclLog(1))[0][9], randString); diff --git a/tests/connection_test.ts b/tests/connection_test.ts index 76f6548a..873d4a56 100644 --- a/tests/connection_test.ts +++ b/tests/connection_test.ts @@ -1,5 +1,4 @@ -import { connect, Redis } from "../mod.ts"; -import { delay } from "../vendor/https/deno.land/std/async/mod.ts"; +import { connect } from "../mod.ts"; import { assertEquals } from "../vendor/https/deno.land/std/testing/asserts.ts"; import { newClient, diff --git a/tests/executor_test.ts b/tests/executor_test.ts index 915f55ab..35c5c2b7 100644 --- a/tests/executor_test.ts +++ b/tests/executor_test.ts @@ -1,9 +1,5 @@ -import { BulkReply, ErrorReplyError, parseURL, replyTypes } from "../mod.ts"; -import { - assert, - assertEquals, - assertThrowsAsync, -} from "../vendor/https/deno.land/std/testing/asserts.ts"; +import { BulkReply, replyTypes } from "../mod.ts"; +import { assertEquals } from "../vendor/https/deno.land/std/testing/asserts.ts"; import { newClient, nextPort, diff --git a/tests/general_test.ts b/tests/general_test.ts index 750c0e38..f52c2133 100644 --- a/tests/general_test.ts +++ b/tests/general_test.ts @@ -1,6 +1,5 @@ import { ErrorReplyError, parseURL } from "../mod.ts"; import { - assert, assertEquals, assertThrowsAsync, } from "../vendor/https/deno.land/std/testing/asserts.ts"; diff --git a/tests/script_test.ts b/tests/script_test.ts index a3ef2d99..26c8c6d0 100644 --- a/tests/script_test.ts +++ b/tests/script_test.ts @@ -1,5 +1,3 @@ -import { connect, Redis } from "../mod.ts"; -import { delay } from "../vendor/https/deno.land/std/async/mod.ts"; import { assert, assertEquals, diff --git a/tests/stream_test.ts b/tests/stream_test.ts index 87c52ab5..5bef6954 100644 --- a/tests/stream_test.ts +++ b/tests/stream_test.ts @@ -123,7 +123,7 @@ suite.test("xread", async () => { assert(a != null); const key2 = randomStream(); - const b = await client.xadd( + await client.xadd( key2, [1000, 0], // You may enter the ID as a numeric pair { air: "ball", friend: "table" }, diff --git a/tools/make_mod.ts b/tools/make_mod.ts index 14a5ecf0..cae73bdc 100755 --- a/tools/make_mod.ts +++ b/tools/make_mod.ts @@ -1,5 +1,7 @@ #!/usr/bin/env deno run --allow-read --allow-write --allow-run +import { readAll, writeAll } from "../vendor/https/deno.land/std/io/util.ts"; + const encoder = new TextEncoder(); const decoder = new TextDecoder(); @@ -14,7 +16,7 @@ async function doc(fileName: string): Promise> { stdout: "piped", }); try { - const out = await Deno.readAll(deno.stdout); + const out = await readAll(deno.stdout); return JSON.parse(decoder.decode(out)); } finally { deno.stdout.close(); @@ -29,9 +31,9 @@ async function fmt(content: string): Promise { stdout: "piped", }); try { - await Deno.writeAll(deno.stdin, encoder.encode(content)); + await writeAll(deno.stdin, encoder.encode(content)); deno.stdin.close(); - const formattedContent = decoder.decode(await Deno.readAll(deno.stdout)); + const formattedContent = decoder.decode(await readAll(deno.stdout)); return formattedContent; } finally { deno.stdout.close(); From 675421a99ab77f5b1a73dd326fa9722303c040cc Mon Sep 17 00:00:00 2001 From: uki00a Date: Sat, 17 Apr 2021 16:51:28 +0900 Subject: [PATCH 5/5] chore: Add new vendor files --- vendor/https/deno.land/std/io/buffer.ts | 1 + vendor/https/deno.land/std/io/util.ts | 1 + 2 files changed, 2 insertions(+) create mode 100644 vendor/https/deno.land/std/io/buffer.ts create mode 100644 vendor/https/deno.land/std/io/util.ts diff --git a/vendor/https/deno.land/std/io/buffer.ts b/vendor/https/deno.land/std/io/buffer.ts new file mode 100644 index 00000000..47f05cda --- /dev/null +++ b/vendor/https/deno.land/std/io/buffer.ts @@ -0,0 +1 @@ +export * from "https://deno.land/std@0.93.0/io/buffer.ts"; diff --git a/vendor/https/deno.land/std/io/util.ts b/vendor/https/deno.land/std/io/util.ts new file mode 100644 index 00000000..eed1a137 --- /dev/null +++ b/vendor/https/deno.land/std/io/util.ts @@ -0,0 +1 @@ +export * from "https://deno.land/std@0.93.0/io/util.ts";