quirrel-dev / quirrel

The Task Queueing Solution for Serverless.
https://quirrel.dev
MIT License
885 stars 67 forks source link

getById not working for long strings #1168

Open ghost opened 9 months ago

ghost commented 9 months ago

Bug Report

Current Behavior Calling getById with a long string (e.g. "handle-018c1fd5-cc2f-7918-9854-a13c929c8727-018c1fd5-d87f-73e4-9d92-d5e5287d0a61-018c1fd5-d89f-7bdd-8b9e-3f3e92ed4807-018c1fd5-d8b0-7744-a2d2-6591919284ae-018c1fd5-d8be-76cb-88fd-cdfbd87faa67-018c1fd5-f666-7ec1-a21a-d9906ca90cef-018c1fd5-ff2c-74cf-8035-b1dc327adf5b-018c1fd5-ff43-7e98-86d9-9a61e0972457-018c1fd5-ff50-7d2c-b4ad-8e916bbb9b81-018c1fd5-ff5e-7202-9236-05d3101130b7-018c1fd5-ff6b-77c0-9c0e-527743cbcd20-018c1fd5-ff78-7d92-8038-0b5ce6c617ae-018c1fd5-ff84-7c5d-b4cf-86d97b32e590-018c1fd5-ff8e-76e5-91a7-0f94d9ca2d3c-018c1fd5-ff97-7a1e-b5da-7f39c3480d23-018c1fd5-ffa0-7841-b129-be878e6898a3-018c1fd5-ffa9-7d90-9d22-083e955c6d95-018c1fd5-ffb3-7d60-bd23-84ff1c9bb9d4-018c1fd5-ffc6-7b0d-9086-1d085f6d9e76-018c1fd5-ffce-7e5e-bec4-c44cf8906feb-018c1fd6-1bf9-75e9-b5b6-b1eb2b795c7b-018c1fd6-1c05-763d-86e5-89efad1495f3-018c1fd6-1c10-72eb-8ab7-b267eada2aa9") will simply return null even if the job exists.

Input Code

      const jobExists = (await queue.getById(jobId)) === null;

Expected behavior/code

It works when just querying all the jobs:

const getJobById = async (jobId: string): Promise<Job<string> | null> => {
  // Helper method because Quirrel getById method does not work for too long strings
  for await (const jobs of queue.get()) {
    for (const job of jobs) {
      if (job.id === jobId) {
        return job;
      }
    }
  }
  return null;
}

Environment

Possible Solution

Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.