Skip to content

Commit

Permalink
docs: add a note about connection pooling
Browse files Browse the repository at this point in the history
Ref #239
  • Loading branch information
palkan committed May 2, 2023
1 parent fc891d8 commit 091e4d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ Logidze.with_meta({ip: request.ip}, transactional: false) do
end
```

**Important:** If you use connection pooling (e.g., PgBouncer), using `.with_meta` without a transaction may lead to unexpected results (since meta is set for a connection). Without a transaction, we cannot guarantee that the same connection will be used for queries (including metadata cleanup).

### Track responsibility

A special application of meta information is storing the author of the change, which is called _Responsible ID_. There is more likely that you would like to store the `current_user.id` that way.
Expand Down

0 comments on commit 091e4d9

Please sign in to comment.