Commit Graph

193 Commits

Author SHA1 Message Date
Quentin Gliech
564e70d8dc perf: avoid unnecessary clones of the log context 2025-04-24 14:19:26 +02:00
Quentin Gliech
2e2193b806 tasks: don't rely on #[instrument(err)] for logging errors 2025-04-18 09:59:31 +02:00
Quentin Gliech
005c427c2f Record the job result from within the job LogContext
This means we can log stats about the job when it finishes, and its
status will have the right log context attached to it.
2025-04-18 09:59:30 +02:00
Quentin Gliech
7c9754d537 Add context to some log messages 2025-04-18 09:58:48 +02:00
Quentin Gliech
9e4689f263 Create a few basic logging contexts 2025-04-16 16:07:29 +02:00
Quentin Gliech
a86696e0a8 Fix Clippy lints introduced by Rust 1.86 2025-04-06 16:18:27 +02:00
Quentin Gliech
fd41b719ba Merge branch 'main' into quenting/dynamic-policy-data 2025-03-14 10:16:16 +01:00
Quentin Gliech
7ec4e1e371 Prune stale policy data once a day 2025-03-13 13:40:59 +01:00
Quentin Gliech
36e2a91c38 Mark the user as deactivated in the user deactivation job 2025-03-11 17:35:13 +01:00
Quentin Gliech
db417dd12e Remove user emails when deactivating a user 2025-03-11 17:35:12 +01:00
Quentin Gliech
c95c087e5e Adjust the jobs retry delays and number of attempts 2025-03-07 15:01:08 +01:00
Quentin Gliech
df5de81c92 Remove generic error type & always use an Arc on the HS connection
This should help us write other implementations of HomeserverConnection
2025-03-03 15:43:13 +01:00
Quentin Gliech
10d7338934 Bump most Rust dependencies 2025-02-24 12:12:07 +01:00
Quentin Gliech
56d9c7e63b Upgrade to Rust 1.85 and edition 2024 2025-02-21 16:15:02 +01:00
Quentin Gliech
c7d2ad7c5c Only expire sessions from dynamic clients 2025-02-12 17:31:21 +01:00
Quentin Gliech
b40fcdd712 Experimental feature to timeout inactive sessions 2025-02-12 17:31:21 +01:00
Quentin Gliech
d8b9bb1d9a Setup job to expire inactive browser sessions 2025-02-12 14:03:41 +01:00
Quentin Gliech
dcc23421c9 Setup a job to expire compatibility sessions 2025-02-12 13:57:36 +01:00
Quentin Gliech
0a624eb92c Setup a job to expire OAuth 2.0 sessions 2025-02-12 13:47:48 +01:00
reivilibre
87009be7e6 Support compatibility sessions that do not have devices (#3801)
Co-authored-by: Quentin Gliech <quenting@element.io>
2025-01-27 14:50:31 +00:00
Quentin Gliech
0bca802585 Merge branch 'main' into quenting/optional-email 2025-01-20 11:31:48 +01:00
Quentin Gliech
5aa9535cb1 Remove unused dependencies 2025-01-16 17:59:03 +01:00
Quentin Gliech
90fb2f0369 Make the password registration create a user_registration 2025-01-14 16:30:44 +01:00
Quentin Gliech
5aa5c9cb03 Job to send the new email authentication codes 2025-01-14 15:47:17 +01:00
Quentin Gliech
9db14f6743 Rip out the email verification codes
This considers all user_emails as confirmed, and removes the verification code.
It will be replaced by a new email authentication code flow
2025-01-14 15:46:45 +01:00
Quentin Gliech
1c6a8000f0 Shutdown the server if any of the tasks crashes (#3672) 2024-12-17 09:11:08 +00:00
Quentin Gliech
2dbfbfb03f Add metrics to the job queue
This adds:

 - a histogram of the time it takes to process a job for each queue,
   with the status of the job (success, failure, etc.)
 - a histogram which records the time it takes to do a "tick", fetch jobs
 - a counter of the number of jobs currently in-flight for each queue
 - a counter which tracks the reasons why the worker got worken up
2024-12-16 14:57:17 +01:00
Quentin Gliech
a26bc6c843 Cleanup revoked tokens instead of expired ones
If we continue deleting expired tokens, we might not record whether the
token was used or not, and not know what to do in case of
a double-refresh.

Revoked tokens are safe to delete.

This also reduces the frequency of the cleanup job to once an hour.
2024-12-11 14:15:01 +01:00
Quentin Gliech
e0aab3740f Remove the schedule_expression from the database & other fixes 2024-12-06 16:24:26 +01:00
Quentin Gliech
fc7dd0ffdf Cron-like recurring jobs 2024-12-06 16:24:26 +01:00
Quentin Gliech
a01201f954 Allow scheduling jobs in the future
Also retries jobs with an exponential backoff.
2024-12-06 16:24:26 +01:00
Quentin Gliech
5ab826c778 Refactor job processing to wait for them to finish on shutdown 2024-12-06 16:24:26 +01:00
Quentin Gliech
7113e0ddf6 Retry failed jobs 2024-12-06 16:24:26 +01:00
Quentin Gliech
ae5374d458 Decide in each job whether it should retry or not 2024-12-06 16:24:26 +01:00
Quentin Gliech
bd72a57719 Actually consume jobs 2024-12-06 16:24:26 +01:00
Quentin Gliech
70b864f609 WIP: job consumption 2024-12-06 16:24:26 +01:00
Quentin Gliech
703bd743d6 Schedule jobs through the new queue 2024-12-06 16:24:26 +01:00
Quentin Gliech
b82483f936 Move the jobs types in the queue module 2024-12-06 16:24:26 +01:00
Quentin Gliech
312640605d Graceful shutdown 2024-12-06 16:24:26 +01:00
Quentin Gliech
c5e447e633 Move the worker logic in a struct 2024-12-06 16:24:26 +01:00
Quentin Gliech
f34ab1089c Make the worker heartbeat take a worker reference 2024-12-06 16:24:26 +01:00
Quentin Gliech
62ccd2b08c New job queue: worker registration and leader election 2024-12-06 16:24:26 +01:00
dependabot[bot]
3b1344896e build(deps): bump futures-lite from 2.4.0 to 2.5.0
Bumps [futures-lite](https://github.com/smol-rs/futures-lite) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/smol-rs/futures-lite/releases)
- [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/futures-lite/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: futures-lite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-12 14:19:39 +01:00
dependabot[bot]
658ade4794 build(deps): bump futures-lite from 2.3.0 to 2.4.0
Bumps [futures-lite](https://github.com/smol-rs/futures-lite) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/smol-rs/futures-lite/releases)
- [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/futures-lite/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: futures-lite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-31 18:12:46 +01:00
dependabot[bot]
686c0255a2 build(deps): bump async-stream from 0.3.5 to 0.3.6
Bumps [async-stream](https://github.com/tokio-rs/async-stream) from 0.3.5 to 0.3.6.
- [Release notes](https://github.com/tokio-rs/async-stream/releases)
- [Commits](https://github.com/tokio-rs/async-stream/compare/v0.3.5...v0.3.6)

---
updated-dependencies:
- dependency-name: async-stream
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 18:50:08 +02:00
Quentin Gliech
9a946c19e7 Remove (C) 2024-09-10 14:28:55 +02:00
Quentin Gliech
9da19e2af0 License headers change 2024-09-05 13:25:42 +02:00
Quentin Gliech
678753c2e1 storage: freeze the error type on BoxRepository
This avoids having to deal with traits bounds everywhere. It also moves
the `boxed()` method to the PgRepository, because it was unnecessary to
keep it on the `Repository` trait
2024-07-26 11:36:55 +02:00
Quentin Gliech
a2f581a99a Kill all sessions when deactivating a user 2024-07-16 14:13:11 +02:00
Quentin Gliech
98d66c1356 Add a way to reactivate users on the homeserver 2024-07-16 13:20:28 +02:00