drewdeponte / octopusci

A multi-branch continuous integration server
MIT License
19 stars 2 forks source link

Job enqueueing is NOT preventing duplicate proj, branch jobs #27

Closed drewdeponte closed 13 years ago

drewdeponte commented 13 years ago

Basically, I had stopped all the octopusci-tentacles and no jobs were running. While the tentacles were not running 3 job build requests came in, in the following order.

  1. my_project_name with branch master
  2. my_project_name with branch unable_to_connect_to_social_media
  3. my_project_name with branch master

It seems that all three requests came in and that the jobs identified by #1, #2, and #3 were executed and running because the Resque interface shows that three workers were working and were all kicked off at the same time. However, for some reason the oldest master jobs that was running did not get its state updated so it still looks as if it is in a pending state.

You can see this in the following screenshot:

https://img.skitch.com/20111111-r9sy6de1ruyf5r3pxquspj8732.jpg

drewdeponte commented 13 years ago

After some further investigation it seems that the most recent master branch job was getting updated by both of the actually jobs building the master branch even though they were building on two different stages. I was able to identify this because I could see duplication in the output and log files. I also noticed that the job initially updated and went green and then after a few minutes I refreshed and the job went to a state of red.

So, I am definitely convinced at this point as before that all the jobs were running it was just that the older master branch build job and the newer master branch build job even though on different stages were updating the most recent job record instead of updating their respective job records as they should.

Also, note that the older master job in the listing is still in the pending state and has not been updated at all.

drewdeponte commented 13 years ago

Thinking about this some more, it seems that the second job for the master branch should never have been queued in the first place. The reason being is that the queueing engine is supposed to be intelligent enough to simply update the data with the original pending job for the master branch rather than creating a new instance of it. That way when the tentacles start up it simply builds the latest version of that branch rather than building an old version of that branch and then the latest version of that branch.

drewdeponte commented 13 years ago

I resolved this issue with the above commit.