You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing a model instance with a CPK and a timestamp as part of the CPK into ActiveJobs an error is raised that the record cannot be found during deserialization. I tracked this down to lossy encoding of timestamps. Using to_s on the timestamp drops milli/micro/nano second precision which is often stored in the DB, which causes a failure to find the record.
I'd suggest converting time objects to a string with .iso8601(9) as that seems to be the highest precision we will encounter on timestamps. I am happy implement this fix if someone can provide guidance on a preference between checking the class type of the id part or checking if it responds to iso8601. Also if there is a preferred testing strategy for something like this.
Extra context on the use case. I have records in TimescaleDB hypertables that often have primary keys of [:created_at, :key].
The text was updated successfully, but these errors were encountered:
When passing a model instance with a CPK and a timestamp as part of the CPK into ActiveJobs an error is raised that the record cannot be found during deserialization. I tracked this down to lossy encoding of timestamps. Using
to_s
on the timestamp drops milli/micro/nano second precision which is often stored in the DB, which causes a failure to find the record.I'd suggest converting time objects to a string with
.iso8601(9)
as that seems to be the highest precision we will encounter on timestamps. I am happy implement this fix if someone can provide guidance on a preference between checking the class type of the id part or checking if it responds toiso8601
. Also if there is a preferred testing strategy for something like this.Extra context on the use case. I have records in TimescaleDB hypertables that often have primary keys of
[:created_at, :key]
.The text was updated successfully, but these errors were encountered: