palkan / logidze

Database changes log for Rails
MIT License
1.6k stars 76 forks source link

docs: logdize cannot set session meta data when using a connection pool #239

Closed bf4 closed 1 year ago

bf4 commented 1 year ago

I was chatting with someone about logidze and they pointed out that setting fields like the responsible id cannot be done in (most?) connection pooling environments. Since we considered connection pooling but did't consider it's effect on logidze, I thought I'd mention here.

palkan commented 1 year ago

Yeah, meta is set per session; so, if you set meta outside of a transaction, there can be a race condition.

Added a note to the documentation.

Probably, we can add support for connection pooling by watching for all transactions opened and closed and re-populating the metadata.