Commit graph

14 commits

Author SHA1 Message Date
Simon Ser 421d3f258a db_postgres: report network metrics with hostname label
This can help figure out when it's necessary to discuss with
network operators to request a connection limit bump.
2022-03-08 11:04:23 +01:00
Simon Ser dac003960c db: allow registering multiple metrics collectors 2022-03-08 10:36:59 +01:00
delthas cae248f672 Add support for the wip soju.im/read capability and READ command
READ lets downstream clients share information between each other about
what messages have been read by other downstreams.

Each target/entity has an optional corresponding read receipt, which is
stored as a timestamp.

- When a downstream sends:
  READ #chan timestamp=2020-01-01T01:23:45.000Z
  the read receipt for that target is set to that date
- soju sends READ to downstreams:
  - on JOIN, if the client uses the soju.im/read capability
  - when the read receipt timestamp is set by any downstream

The read receipt date is clamped by the previous receipt date and the
current time.
2022-02-11 19:41:46 +01:00
Simon Ser f858ec163c db_postgres: use enum for sasl_mechanism
Ensures only supported mechanisms get stored in the DB.
2022-02-08 15:38:41 +01:00
Simon Ser ea98ac042e Add Prometheus instrumentation for the database 2021-11-17 15:58:19 +01:00
Simon Ser a6aa7f0008 Make Network.Nick optional
Make Network.Nick optional, default to the user's username. This
will allow adding a global setting to set the nickname in the
future, just like we have for the real name.

References: https://todo.sr.ht/~emersion/soju/110
2021-11-02 23:33:17 +01:00
Simon Ser 9ec1f1a5b0 Add context args to Database interface
This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.
2021-10-18 19:15:15 +02:00
Hubert Hirtz 350057e60b Set hard timeouts on DB transactions 2021-10-15 22:39:14 +02:00
Simon Ser 28e1ca51e7 db_postgres: remove unnecessary DEFAULT NULL in schema 2021-10-14 10:09:01 +02:00
Simon Ser d334bb18a2 db_postgres: use tx for all queries in StoreClientDeliveryReceipts 2021-10-13 19:15:50 +02:00
Simon Ser 79dbb20f98 db_postgres: quote table name in StoreClientDeliveryReceipts 2021-10-13 17:38:20 +02:00
Simon Ser ca9fa9198c db_postgres: fix constraints errors
Stop using ON CONFLICT DO UPDATE.

Closes: https://todo.sr.ht/~emersion/soju/138
2021-10-13 10:12:14 +02:00
Hubert Hirtz eb41ed4171 db_postgres: handle both constraints on network updates
Closes: https://todo.sr.ht/~emersion/soju/138
2021-10-13 08:53:49 +02:00
Hubert Hirtz 6e06663615 PostgreSQL support 2021-10-11 15:21:04 +02:00