Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* bump: Upgrade deno to v1.9.0
* fix: Fix lint errors
* fix: Use std/io/buffer instead of Deno.Buffer
* fix: Use std/io/util instead of Deno.readAll and writeAll
  • Loading branch information
uki00a authored Apr 17, 2021
1 parent 0a0a70c commit 4b25972
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .denov
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.8.2
v1.9.0
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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++;
Expand Down
4 changes: 3 additions & 1 deletion modules-lock.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"https://deno.land/std": {
"version": "@0.91.0",
"version": "@0.93.0",
"modules": [
"/async/mod.ts",
"/testing/bench.ts",
"/testing/asserts.ts",
"/io/buffer.ts",
"/io/bufio.ts",
"/io/util.ts",
"/fmt/colors.ts"
]
}
Expand Down
4 changes: 3 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"https://deno.land/std": {
"version": "@0.91.0",
"version": "@0.93.0",
"modules": [
"/async/mod.ts",
"/testing/bench.ts",
"/testing/asserts.ts",
"/io/buffer.ts",
"/io/bufio.ts",
"/io/util.ts",
"/fmt/colors.ts"
]
}
Expand Down
3 changes: 2 additions & 1 deletion protocol/reply.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -218,7 +219,7 @@ async function readLine(reader: BufReader): Promise<string> {
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;
Expand Down
5 changes: 1 addition & 4 deletions redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,16 @@ import type { RedisConnectionOptions } from "./connection.ts";
import { CommandExecutor, MuxExecutor } from "./executor.ts";
import { unwrapReply } from "./protocol/mod.ts";
import type {
ArrayReply,
Binary,
Bulk,
BulkNil,
BulkReply,
BulkString,
ConditionalArray,
Integer,
IntegerReply,
Raw,
RedisValue,
SimpleString,
SimpleStringReply,
} from "./protocol/mod.ts";
import { createRedisPipeline } from "./pipeline.ts";
import { psubscribe, subscribe } from "./pubsub.ts";
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/acl_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions tests/connection_test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
8 changes: 2 additions & 6 deletions tests/executor_test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 0 additions & 1 deletion tests/general_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ErrorReplyError, parseURL } from "../mod.ts";
import {
assert,
assertEquals,
assertThrowsAsync,
} from "../vendor/https/deno.land/std/testing/asserts.ts";
Expand Down
2 changes: 0 additions & 2 deletions tests/script_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { connect, Redis } from "../mod.ts";
import { delay } from "../vendor/https/deno.land/std/async/mod.ts";
import {
assert,
assertEquals,
Expand Down
2 changes: 1 addition & 1 deletion tests/stream_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
8 changes: 5 additions & 3 deletions tools/make_mod.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -14,7 +16,7 @@ async function doc(fileName: string): Promise<Array<Node>> {
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();
Expand All @@ -29,9 +31,9 @@ async function fmt(content: string): Promise<string> {
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();
Expand Down
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/async/mod.ts
Original file line number Diff line number Diff line change
@@ -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";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/fmt/colors.ts
Original file line number Diff line number Diff line change
@@ -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";
1 change: 1 addition & 0 deletions vendor/https/deno.land/std/io/buffer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "https://deno.land/[email protected]/io/buffer.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/io/bufio.ts
Original file line number Diff line number Diff line change
@@ -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";
1 change: 1 addition & 0 deletions vendor/https/deno.land/std/io/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "https://deno.land/[email protected]/io/util.ts";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/testing/asserts.ts
Original file line number Diff line number Diff line change
@@ -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";
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/testing/bench.ts
Original file line number Diff line number Diff line change
@@ -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";

0 comments on commit 4b25972

Please sign in to comment.