As shown in the code below, I call the “defineQueuePush” function, push to the queue, and then run “processQueue” with an asynchronous event, but “processQueue” times out in 25 seconds.
What could be the cause?
・resolver.js
const importQueue = new Queue({ key: 'import-queue' });
export const defineQueuePush = async(resolver) =>{
resolver.define("QueuePush", async (req) => {
try {
console.log("start QueuePush");
const jobId = await importQueue.push({number:1});
return {
message: "ok",
jobId: jobId,
};
} catch (e) {
return {
message: e.message || e,
jobId: null,
};
}
});
};
export const defineProcessQueue = async (resolver) => {
resolver.define("processQueue", async ({payload}) => {
console.log('Received from queue1:', payload);
for (let number = 0; number <= 8; number++) {
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
await sleep(5000);
console.log(number);
}
});
};
export const handler = resolver.getDefinitions();
・index.js
import Resolver from "@forge/resolver";
import {
defineQueuePush,
defineProcessQueue
} from "./resolvers/jiraResolvers";
const resolver = new Resolver();
defineQueuePush(resolver);
defineProcessQueue(resolver);
export const handler = resolver.getDefinitions();
・manifest.yml
consumer:
- key: queue-consumer
queue: import-queue
resolver:
function: resolver
method: processQueue
function:
- key: resolver
handler: index.handler