From 23e3e0b7aeff03beef822296a6cf258a019e7e96 Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Tue, 21 Nov 2023 16:05:15 +0800 Subject: [PATCH] replace options --- lib/channel.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/channel.js b/lib/channel.js index 09b53d6..ad5d11b 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -29,7 +29,6 @@ class Channel extends EventEmitter { max: options.max } - this.options = options this.connection = connection this.closed = false this.listening = null @@ -171,11 +170,9 @@ class Channel extends EventEmitter { tailable: true, awaitData: true, timeout: false, - sortValue: { $natural: -1 }, - numberOfRetries: Number.MAX_VALUE, - tailableRetryInterval: self.options.retryInterval + maxAwaitTimeMS: self.options.retryInterval } - ) + ).hint({ $natural: 1 }) const next = self.handle(function (doc) { // There is no document only if the cursor is closed by accident. // F.e. if collection was dropped or connection died. @@ -227,7 +224,7 @@ class Channel extends EventEmitter { function onCollection (collection) { const cursor = collection .find(latest ? { _id: latest._id } : {}, { timeout: false }) - .sort({ $natural: -1 }) + .hint({ $natural: -1 }) .limit(1) cursor .next()