Closed (fixed)
Project:
Beanstalkd Integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2012 at 11:52 UTC
Updated:
4 Jan 2014 at 01:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gordon commentedWe can't change the BeanstalkdQueue::createItem() or it is going to break the interface and it will not run.
However the actual Pheanstalk object is "super loaded" onto the standard DrupalQueue object so that you can treat the BeanstalkdQueue as a Pheanstalk object and call put directly.
BeanstalkdQueue::put()
The problem is that the put command the payload will not get converted into the standard format that createItem() will do.
If you want you could add in the functionality to convert the payload to the correct format in the __call() to convert the payload correctly.
Also change the createItem() to call $this->put() so the actual put is in single place, and not duplicated.
Comment #2
nicholasthompsonI see - that would work quite nicely in terms of code cleanup... so basically:
Would become:
Then, in the
__call, add a handler for theputcommand which rebuilds the$record.The Put handler can expect the parameters in the same order as defined here:
https://github.com/pda/pheanstalk/blob/master/classes/Pheanstalk.php#L261
And if not present, fall back to the
$this->beanstalkd_params.I'll get on making a patch for this.
Comment #3
nicholasthompsonHow's about this for a "phase 1" patch?
I moved the "put" handling into the
_callhandler. This also now supportsputInTubetoo.This seems to pass the test file too. I will test it with our D7 codebase tomorrow.
Nick
EDIT: This patch also cleans up the way the command groups are handled. There is no longer one for an array of tubes and another for a single tube - it assumes the same functionality for both and builds the
$tubesarray based in the parameters (if a single item was passed in, $tubes becomes a single item array - otherwise it becomes the array that was passed in as arg 0).Comment #4
gordon commentedI don't really like this method of casting arrays into objects.
Also can you also split up the clean up and the addition of the put(), putInTube() into separate patches so that they can been easier to review.
Thanks.
Comment #5
gordon commentedbump
Comment #6
gordon commentedFix in dev