Commit Graph

185 Commits

Author SHA1 Message Date
Quentin Gliech 93b991ec95 Mark the user as deactivated in the user deactivation job 2025-03-11 17:35:13 +01:00
Quentin Gliech 4e2f38ea41 Remove user emails when deactivating a user 2025-03-11 17:35:12 +01:00
Quentin Gliech 79cef5ebe0 Adjust the jobs retry delays and number of attempts 2025-03-07 15:01:08 +01:00
Quentin Gliech f484896f16 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 a538b50233 Bump most Rust dependencies 2025-02-24 12:12:07 +01:00
Quentin Gliech 3d2b67a0b2 Upgrade to Rust 1.85 and edition 2024 2025-02-21 16:15:02 +01:00
Quentin Gliech 9504174812 Only expire sessions from dynamic clients 2025-02-12 17:31:21 +01:00
Quentin Gliech 935400d87b Experimental feature to timeout inactive sessions 2025-02-12 17:31:21 +01:00
Quentin Gliech 2ae36b4a84 Setup job to expire inactive browser sessions 2025-02-12 14:03:41 +01:00
Quentin Gliech 4353185802 Setup a job to expire compatibility sessions 2025-02-12 13:57:36 +01:00
Quentin Gliech 34f7e49a54 Setup a job to expire OAuth 2.0 sessions 2025-02-12 13:47:48 +01:00
reivilibre 0c26dd859a 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 6092efe949 Merge branch 'main' into quenting/optional-email 2025-01-20 11:31:48 +01:00
Quentin Gliech 9247885518 Remove unused dependencies 2025-01-16 17:59:03 +01:00
Quentin Gliech 0bedaf3745 Make the password registration create a user_registration 2025-01-14 16:30:44 +01:00
Quentin Gliech 5f5fc44fbd Job to send the new email authentication codes 2025-01-14 15:47:17 +01:00
Quentin Gliech 0513f198d8 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 88fb4ed025 Shutdown the server if any of the tasks crashes (#3672) 2024-12-17 09:11:08 +00:00
Quentin Gliech c6e85edfc1 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 0360427adf 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 2345685b92 Remove the schedule_expression from the database & other fixes 2024-12-06 16:24:26 +01:00
Quentin Gliech 186860b10f Cron-like recurring jobs 2024-12-06 16:24:26 +01:00
Quentin Gliech cb07af5008 Allow scheduling jobs in the future
Also retries jobs with an exponential backoff.
2024-12-06 16:24:26 +01:00
Quentin Gliech b2116d86e3 Refactor job processing to wait for them to finish on shutdown 2024-12-06 16:24:26 +01:00
Quentin Gliech 358186187d Retry failed jobs 2024-12-06 16:24:26 +01:00
Quentin Gliech 5ca023ab51 Decide in each job whether it should retry or not 2024-12-06 16:24:26 +01:00
Quentin Gliech 89856576cb Actually consume jobs 2024-12-06 16:24:26 +01:00
Quentin Gliech d9e22f8884 WIP: job consumption 2024-12-06 16:24:26 +01:00
Quentin Gliech b689554909 Schedule jobs through the new queue 2024-12-06 16:24:26 +01:00
Quentin Gliech 1bcfd3b8f8 Move the jobs types in the queue module 2024-12-06 16:24:26 +01:00
Quentin Gliech 15f589a22a Graceful shutdown 2024-12-06 16:24:26 +01:00
Quentin Gliech cdfa42cfa8 Move the worker logic in a struct 2024-12-06 16:24:26 +01:00
Quentin Gliech 19a2d15c9c Make the worker heartbeat take a worker reference 2024-12-06 16:24:26 +01:00
Quentin Gliech a80077907b New job queue: worker registration and leader election 2024-12-06 16:24:26 +01:00
dependabot[bot] 59aedc0ece 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] 1871b2c4a6 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] 556808b413 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 ed4b6c42a7 Remove (C) 2024-09-10 14:28:55 +02:00
Quentin Gliech f6bb100c0a License headers change 2024-09-05 13:25:42 +02:00
Quentin Gliech 144de0deb2 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 6db455412f Kill all sessions when deactivating a user 2024-07-16 14:13:11 +02:00
Quentin Gliech 0207495225 Add a way to reactivate users on the homeserver 2024-07-16 13:20:28 +02:00
Quentin Gliech 3eab10672f Add a lock during syncs of user devices 2024-07-16 09:32:07 +02:00
Quentin Gliech 35c06ac27b Deprecate the ProvisionDeviceJob and DeleteDeviceJob jobs 2024-07-16 09:32:07 +02:00
Quentin Gliech 11fd3b231a Don't hold the database connection for too long 2024-07-16 09:32:07 +02:00
Quentin Gliech bf276289b6 Fully sync the devices with the homeserver 2024-07-16 09:32:07 +02:00
dependabot[bot] 5339b19f38 build(deps): bump event-listener from 5.3.0 to 5.3.1
Bumps [event-listener](https://github.com/smol-rs/event-listener) from 5.3.0 to 5.3.1.
- [Release notes](https://github.com/smol-rs/event-listener/releases)
- [Changelog](https://github.com/smol-rs/event-listener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/event-listener/compare/v5.3.0...v5.3.1)

---
updated-dependencies:
- dependency-name: event-listener
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-01 10:35:46 +02:00
Quentin Gliech c156a3891e Actually send emails for recovery 2024-06-28 15:59:21 +02:00
Quentin Gliech 4a60f5d32f Job to generate codes for all emails in a recovery session 2024-06-28 15:59:21 +02:00
Quentin Gliech d061d7f6b3 Move tokio to a workspace dependency 2024-05-15 14:54:34 +02:00