mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
Fix processor running out of file descriptors due to re-creating redis connections
This commit is contained in:
parent
65a6ea4546
commit
04d482650c
1 changed files with 3 additions and 2 deletions
|
@ -10,6 +10,8 @@ global.NylasError = NylasError;
|
|||
const MessageAttributes = ['body', 'processed', 'to', 'from', 'cc', 'replyTo', 'bcc', 'snippet', 'threadId']
|
||||
const MessageProcessorVersion = 1;
|
||||
|
||||
const redis = PubsubConnector.buildClient();
|
||||
|
||||
function runPipeline({db, accountId, message}) {
|
||||
console.log(`Processing message ${message.id}`)
|
||||
return processors.reduce((prevPromise, processor) => (
|
||||
|
@ -36,8 +38,7 @@ function saveMessage(message) {
|
|||
}
|
||||
|
||||
function dequeueJob() {
|
||||
const conn = PubsubConnector.buildClient()
|
||||
conn.brpopAsync('message-processor-queue', 10).then((item) => {
|
||||
redis.brpopAsync('message-processor-queue', 10).then((item) => {
|
||||
if (!item) {
|
||||
return dequeueJob();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue