On Fri, Dec 14, 2012 at 7:41 AM, FeIn <aci...@gmail.com> wrote:
> Hi all,
> I have a typical web application that does some basic CRUD operations.
> Operations that modify the database (inserts, updates, deletes)
> trigger a background gearman job to refresh the cache that is used for
> another application. The problem is that when I do an update the
> gearman worker script (which has its own database connection) does not
> pick up the updates. For example if I were to update a row: UPDATE
> table SET rowname = 'updated value' WHERE rowid = 1, the respective
> row is updated correctly, but when the worker gets around to handle
> the job of refreshing the cache for that row the SELECT FROM table
> WHERE rowid = 1 picks up the older value (the one before the update).
> I activated the mysql log and the queries are definitely run in the
> correct order (first the update and the select on a another
> connection). Has anybody encountered this issue before? I should also
> mention that the worker is setup to run a certain number of cache
> refreshing jobs after which it will die, but it will use the same
> connection to do those jobs. If I force the worker to use a new
> connection for each job everything works fine, otherwise the update is
> picked up only for the first job but not for the subsequent jobs. Any
> Thanks in advance.
The problem was on my side, and it had to with Doctrine's identity
map. I cleared Doctrine's entity manager for every job handled by the
Gearman worker and it seems that everything works fine now.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php