The async event times out after 25 seconds

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

Hey @r.fukushima,

On the limited manifest provided its a bit hard to tell but I assume this could be due to the function referenced by the consumer module being referenced by another module type? If a function is referenced by multiple module types it gets the shortest timeout that applies across them.

If this is the case you can fix this by defining a second function that is used by only queue-consumer.

The only reference I can currently see in our docs to this is here. So I’ll discuss making this limitation more visible with the team.

If this isn’t the case it would be great if you can supply more of your manifest.

Thanks!

1 Like

Thanks!