gojenkins icon indicating copy to clipboard operation
gojenkins copied to clipboard

Allow running the same job multiple times concurrently

Open raxod502-plaid opened this issue 4 years ago • 9 comments

I am not sure why this code was included originally. It prevents invoking a job multiple times with different parameters.

raxod502-plaid avatar Feb 17 '21 19:02 raxod502-plaid

Hi @raxod502-plaid if i understand correctly, the queue period is very short (less than a few seconds? I don't have the exact number yet), but I am able to use the current code to trigger job multiple times, each triggering has a few seconds interval.

The queue period is exist in Jenkins API, I think it is there to prevent race condition in the server itself, before Jenkins API removing this queue period, i worry that simplify bypass it will get us into weird state.

figo avatar Feb 26 '21 18:02 figo

OK, but the current behavior is definitely wrong; it returns a nil error value indicating that the job was triggered when it actually wasn't. The library should wait and retry if there's a mandatory waiting period. Furthermore, that Error.Printf actually causes a panic due to some internal bug, which crashes the whole application. The overall effect is a very poor user experience.

raxod502-plaid avatar Feb 26 '21 18:02 raxod502-plaid

I agree, fine with adding an automatic retry logic. then should return error if timeout on waiting.

figo avatar Feb 26 '21 19:02 figo

See also #112

CCFenner avatar May 17 '21 10:05 CCFenner

FWIW, we've applied this pull request in our fork and have been using it successfully for some months now to trigger ~100 instances of the same job in a minute or less.

raxod502-plaid avatar May 19 '21 20:05 raxod502-plaid

We have same issue, but the PR needs to be extended to modify same code in Invoke() method

dheraskou avatar Jan 18 '23 02:01 dheraskou

FWIW, we've applied this pull request in our fork and have been using it successfully for some months now to trigger ~100 instances of the same job in a minute or less.

hi, I have met the same situation with yours, I wanna know if there is anything wrong with your job when you guys use this in your fork, thanks!

wanghao75 avatar Jul 27 '23 07:07 wanghao75

FWIW, we've applied this pull request in our fork and have been using it successfully for some months now to trigger ~100 instances of the same job in a minute or less.

hi, I have met the same situation with yours, I wanna know if there is anything wrong with your job when you guys use this in your fork, thanks!

No, works fine

dheraskou avatar Jul 28 '23 08:07 dheraskou

FWIW, we've applied this pull request in our fork and have been using it successfully for some months now to trigger ~100 instances of the same job in a minute or less.

hi, I have met the same situation with yours, I wanna know if there is anything wrong with your job when you guys use this in your fork, thanks!

No, works fine

thanks for reply

wanghao75 avatar Jul 31 '23 03:07 wanghao75