On Wednesday, February 26, 2020 at 8:14:45 PM UTC-8, Sunho Kim wrote:
>
> Hi,
>
> We are experiencing a issue that [] fails.
>
> To give you some context, here is the flow.
>
> 1. We create multiple records of `Artist`s.
> 2. Right after creation, we run multiple workers that each of them fetch 
> one of the newly created Artists by calling `Artist[id]` and it returns 
> `nil`.
> 3. Job fails, reruns, and eventually succeeds fetching.
>

Creation runs into a transaction by default.  If the job runs before the 
transaction commits, you get the behavior you see.  Use 
Database#after_commit to schedule the job so it runs after the transaction 
commits.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/c0041d69-3863-4155-b334-ff0198d2b300%40googlegroups.com.

Reply via email to