riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.34k stars 89 forks source link

Leader election fails with pq driver #566

Open wydengyre opened 2 weeks ago

wydengyre commented 2 weeks ago

A repo demonstrating the issue is available here: https://github.com/wydengyre/dbsqlintervaldemo

Using riverdatabasesql with the pq driver will result in failure of the leader election system.

The leader election SQL will result in expires_at being set to a time in the year 2183: https://github.com/FiveBellsSettlement/river/blob/62ce779744c2d2434cc41eb02a6f19db419dc79e/riverdriver/riverdatabasesql/internal/dbsqlc/river_leader.sql.go#L13

brandur commented 2 weeks ago

Yeah, we've suspect that River isn't compatible with lib/pq. riverdatabasesql is mainly meant for compatibility through a database/sql interface that's using an underlying Pgx driver. I might try to fix it depending on time, but given lib/pq's ancient and been in maintenance mode only for years, I'm not sure how soon I'll get to it.

OOC, what's the main thing blocking you from migrating to a more modern driver like Pgx?