Skip to content

after_commit callback #191

@josh-m-sharpe

Description

@josh-m-sharpe

Is there any way to make the method defined by after_transition/do fire after the SQL commit has taken place?

I'm seeing race condition between state machine and resque. That is, if I drop an event in an after_transition, resque will pick up the job, and load the object before the initial transaction has been committed to the database - thus getting stale data.

If I dropped the event after the COMMIT has taken place, this would be a non-issue. Fixing this 'bug' on the resque side is hacky at best. I could lock, sleep, loop/repeat, meh, none of it looks good.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions