Upgrade async package to 3.2.2 (#8447)

* Revert "Revert "Bump async to 3.2.2 (#7618)""

This reverts commit 75153a555211d654744c2e61e27fe21085826c22.

* [web] fix usage of async.queue.drain in script

* [clsi] fix usage of async.queue.drain

* [spelling] fix usage of async.queue.drain

* [redis-wrapper] fix usage of async.queue.drain

* [web] Test that LockManager queue is cleared

This protects against a regression found when upgrading the
async package. Here we test that the `queue.drain` callback
is really getting called, and the lock is being removed from
the LOCK_QUEUES map.

* [redis-wrapper] Upgrade async to 3.2.2

GitOrigin-RevId: df921e6d7f1d505bd467f22e58600ba1aff48869
This commit is contained in:
June Kelly
2022-06-21 09:07:14 +01:00
committed by Copybot
parent 1c78e211f6
commit a450a74351
23 changed files with 118 additions and 326 deletions

View File

@@ -137,7 +137,9 @@ module.exports = class RedisWebLocker {
queue = async.queue(handler, 1)
queue.push(task)
// remove the queue object when queue is empty
queue.drain = () => LOCK_QUEUES.delete(queueName)
queue.drain(() => {
LOCK_QUEUES.delete(queueName)
})
// store the queue in our global map
LOCK_QUEUES.set(queueName, queue)
} else {
@@ -189,4 +191,8 @@ module.exports = class RedisWebLocker {
}
})
}
_lockQueuesSize() {
return LOCK_QUEUES.size
}
}

View File

@@ -26,13 +26,13 @@
"@overleaf/o-error": "^3.4.0"
},
"dependencies": {
"ioredis": "~4.27.1",
"async": "0.6.2"
"async": "^3.2.2",
"ioredis": "~4.27.1"
},
"devDependencies": {
"@overleaf/logger": "*",
"@overleaf/o-error": "^3.4.0",
"chai": "^4.3.6",
"@overleaf/logger": "*",
"mocha": "^8.4.0",
"sandboxed-module": "^2.0.4",
"sinon": "^9.2.4"