mmoreram / GearmanBundle

GearmanBundle for Symfony2
MIT License
236 stars 104 forks source link

New GEARMAN_WORK_STARTING event on new job #138

Closed dav-m85 closed 9 years ago

dav-m85 commented 9 years ago

In order to implement a clean worker shutdown (incoming pull request), I need a new event to be dispatched when a worker starts to process a new job. I added testing for the existing GEARMAN_WORK_EXECUTED event, and for the new one.

I opened also a pull request against our company fork.

dav-m85 commented 9 years ago

If you're interested, I also implemented a backport for v2.3.3 here

Sadly, we're still using symfony 2.1 on some projects.

mmoreram commented 9 years ago

@dav-m85 Awesome!

Have you checked this feature is not BCBreak?

mmoreram commented 9 years ago

BTW, If you're using SF2.1 you can upgrade to SF2.6 right? I mean, there is no BC Break, so you shouldnt have any problem :S

dav-m85 commented 9 years ago

It is not, I simply proxy the add_function call to capture new jobs and send the starting event.

The projet on which I intend to use the feature is dead locked on sf2.1, and I cannot upgrade past 2.3.3 because of the DoctrineCache dependency (which requires sf/framework 2.4). Backporting was quite easy so that's the solution I chose.

dav-m85 commented 9 years ago

I added the ability to workers to end themselves on USR1 signal, you can have a look at it on https://github.com/lafourchette/GearmanBundle/pull/3

No BC-break so far. Would you like me to forward-porting this feature ?

mmoreram commented 9 years ago

Great. Would be nice to document these new features before merging.

Could you please add it? Or anyone?

dav-m85 commented 9 years ago

Yes sure, I'll work on it.

mmoreram commented 9 years ago

Ping @dav-m85 Any documentation here?

dav-m85 commented 9 years ago

@mmoreram Documentation added ! Not sure it is enough though, please give directions if not :)

mmoreram commented 9 years ago

@dav-m85 Awesome. I will merge this PR, and please, I will need some feedback :)