-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blocking_activity_logger: can't convert String into an exact number #51
Comments
mid-testing on this patch, maybe it solves things for older gem versions (if that's the issue): jakswa@3077be4 def format_start_time(start_time, reference_time = Time.now)
+ start_time = Time.parse(start_time) if start_time.is_a?(String)
duration = (reference_time - start_time).round
"transaction started #{duration} #{'second'.pluralize(duration)} ago"
end |
Hello @jakswa, thanks for the report! Which version of PG and of the pg gem are you using? Your fix looks right, but it might be valuable to identify the root cause. |
No problem! I'm excited to try and guard against some of the blunders this gem seems to solve.
I was testing this locally on:
Agree. I tried some quick digs trying to find a version to alter and test, but I am in a bit of a time crunch in a big rails repo with lots of gem dependencies. |
Ok, you could be missing the proper For me it's Could you please indicate the version of activerecord you are using so I can check? (a proper fix in this case could be to assign the right type map for the alternate connection, so the PG client takes types into account) |
the above was on activerecord 5.2.6 |
> SafePgMigrations.alternate_connection.raw_connection.type_map_for_results
=> #<PG::TypeMapByOid:0x0000560181136720>
`` |
The last message got me thinking that we might have a monkey-patch or override in play somewhere messing with this, but so far my attempts at disabling random hooks/gems/etc have failed to get the issue to go away. So, that's saying: This could be a me/us issue if no one else can reproduce and maybe we're just settling in to maintain our forked patch. If I find time to get a rails skeleton going to reproduce, I'll give that a go, so there's hope later maybe. Maybe I can get solid steps for reproduction. |
Haven't gotten around to find time for accurate reproduction steps, I'll close this until there's more movement. Sorry to leave it hanging around! |
Hey @jakswa, I was lucky enough to reproduce this issue; it's now fixed :) |
safe-pg-migrations/lib/safe-pg-migrations/plugins/blocking_activity_logger.rb
Lines 68 to 87 in 07a3551
currently debugging locally a (probably gem versioning) issue where this
value
has a string timestamp like:and then the time formatter blows up with:
The text was updated successfully, but these errors were encountered: