You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
wip
This commit is contained in:
@@ -2,7 +2,7 @@ import { EventEmitter } from 'events';
|
||||
import * as net from 'net';
|
||||
import * as tls from 'tls';
|
||||
import { ConnectionTimeoutError, ClientClosedError, SocketClosedUnexpectedlyError, ReconnectStrategyError } from '../errors';
|
||||
import { promiseTimeout } from '../utils';
|
||||
import { setTimeout } from 'timers/promises';
|
||||
import { RedisArgument } from '../RESP/types';
|
||||
|
||||
export interface RedisSocketCommonOptions {
|
||||
@@ -159,7 +159,7 @@ export default class RedisSocket extends EventEmitter {
|
||||
}
|
||||
|
||||
this.emit('error', err);
|
||||
await promiseTimeout(retryIn);
|
||||
await setTimeout(retryIn);
|
||||
this.emit('reconnecting');
|
||||
}
|
||||
} while (this._isOpen && !this._isReady);
|
||||
@@ -283,14 +283,6 @@ export default class RedisSocket extends EventEmitter {
|
||||
this.emit('end');
|
||||
}
|
||||
|
||||
cork(): void {
|
||||
this._socket?.cork();
|
||||
}
|
||||
|
||||
uncork(): void {
|
||||
this._socket?.uncork();
|
||||
}
|
||||
|
||||
ref(): void {
|
||||
this._isSocketUnrefed = false;
|
||||
this._socket?.ref();
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// import { SQUARE_SCRIPT } from '../client/index.spec';
|
||||
// import { RootNodesUnavailableError } from '../errors';
|
||||
// import { spy } from 'sinon';
|
||||
// import { promiseTimeout } from '../utils';
|
||||
// import { setTimeout } from 'timers/promises';
|
||||
// import RedisClient from '../client';
|
||||
|
||||
// describe('Cluster', () => {
|
||||
@@ -284,7 +284,7 @@
|
||||
|
||||
// // wait for migrating node to be notified about the new topology
|
||||
// while ((await migratingClient.clusterInfo()).state !== 'ok') {
|
||||
// await promiseTimeout(50);
|
||||
// await setTimeout(50);
|
||||
// }
|
||||
|
||||
// // make sure to cause `MOVED` error
|
||||
@@ -340,7 +340,7 @@
|
||||
|
||||
// // wait for migrating node to be notified about the new topology
|
||||
// while ((await migratingClient.clusterInfo()).state !== 'ok') {
|
||||
// await promiseTimeout(50);
|
||||
// await setTimeout(50);
|
||||
// }
|
||||
|
||||
// const listener = spy();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import TestUtils from '@redis/test-utils';
|
||||
import { SinonSpy } from 'sinon';
|
||||
import { promiseTimeout } from './utils';
|
||||
import { setTimeout } from 'timers/promises';
|
||||
|
||||
const utils = new TestUtils({
|
||||
dockerImageName: 'redis',
|
||||
@@ -57,6 +57,6 @@ export async function waitTillBeenCalled(spy: SinonSpy): Promise<void> {
|
||||
throw new Error('Waiting for more than 1 second');
|
||||
}
|
||||
|
||||
await promiseTimeout(50);
|
||||
await setTimeout(50);
|
||||
} while (spy.callCount === calls);
|
||||
}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
export function promiseTimeout(ms: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
@@ -5,7 +5,8 @@
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist/"
|
||||
"dist/",
|
||||
"!dist/tsconfig.tsbuildinfo"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'"
|
||||
|
@@ -167,6 +167,16 @@ The Node Redis client class is an Nodejs EventEmitter and it emits an event each
|
||||
|
||||
> The client will not emit [any other events](../../docs/v3-to-v4.md#all-the-removed-events) beyond those listed above.
|
||||
|
||||
### Links
|
||||
|
||||
- [Multi](../../docs/multi.md).
|
||||
- [Pub/Sub](../../docs/pub-sub.md).
|
||||
- [Scan Iterators](../../docs/scan-iterators.md).
|
||||
- [Programmability](../../docs/programmability.md).
|
||||
- [Command Options](../../docs/command-options.md).
|
||||
- [Blocking Commands](../../docs/blocking-commands.md).
|
||||
- [Clustering](../../docs/clustering.md).
|
||||
|
||||
## Supported Redis versions
|
||||
|
||||
Node Redis is supported with the following versions of Redis:
|
||||
@@ -192,13 +202,3 @@ Thank you to all the people who already contributed to Node Redis!
|
||||
## License
|
||||
|
||||
This repository is licensed under the "MIT" license. See [LICENSE](../../LICENSE).
|
||||
|
||||
### Links
|
||||
|
||||
- [Multi](../../docs/multi.md).
|
||||
- [Pub/Sub](../../docs/pub-sub.md).
|
||||
- [Scan Iterators](../../docs/scan-iterators.md).
|
||||
- [Programmability](../../docs/programmability.md).
|
||||
- [Command Options](../../docs/command-options.md).
|
||||
- [Blocking Commands](../../docs/blocking-commands.md).
|
||||
- [Clustering](../../docs/clustering.md).
|
||||
|
Reference in New Issue
Block a user