OptimalBits / bull

Premium Queue package for handling distributed jobs and messages in NodeJS.
Other
15.58k stars 1.43k forks source link

Variable name changing when promote Queue #2774

Closed GianPiR closed 1 month ago

GianPiR commented 1 month ago

Hi, I am using Bull with redis and encountering an issue when promoting delayed jobs. Specifically, a variable name I use in the job data gets changed after the promote.

I pass the following data:

Queue.add(
  'SendUserBikeNotificationsQueue',
  {
    user_bike_id,
    state_notification_received: state_notification,
    country_code,
    language_code,
  },
  {
    delay,
    removeOnComplete: { age: 3600 },
    jobId: `sendBikeNotification:${user_bike_id}`,
  }
);

In the delayed queue, all the data appears correctly, including the state_notification_received field: Captura de Tela 2024-09-27 às 13 46 47

However, when I promote, the state_notification_received field are replaced by empty string in the job's data: Captura de Tela 2024-09-27 às 14 30 34

I don't know if is some reserved word or a problem with redis.

roggervalf commented 1 month ago

hi @GianPiR, promote method does not affect data property https://github.com/OptimalBits/bull/blob/develop/lib/commands/promote-5.lua#L40 we only set delay attribute to 0 and this job is moved to wait state. Data is an object that is stringified so probably you are also calling update method to modify that payload :thinking:

manast commented 1 month ago

@GianPiR in fact you are seeing two different jobs as the job ids do not match.