-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add background_updates endpoints #24
Conversation
pub name: String, | ||
|
||
/// Total number of processed "items" | ||
pub total_item_count: i64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: one of the background updates is syncing the user directory, which in huge servers could reach to billions. At least, I've seen it reaching a billion. Feel free to correct me here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was part of the spec, I would be a bit concerned about this (especially if the value range wasn't called out in the spec). However, it's just the Synapse Admin API which is not as rigorously specified as the official /_matrix/
endpoints so going by what makes sense realistically is perfectly fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set it to i32. I haven't found any specs to how high this can get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, why? The previous type made more sense to me with the context you provided 😅
Or actually, why allow negative values? I think the two most sensible types here would be u64
and js_int::UInt
(which would be used if this was in ruma itself).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Darn it. Yes, I should have used unsigned here.
I thought it's good to allocate the least memory possible since there was no documentation. You are right, my context should have been my documentation for it. 👍
7e868d3
to
2b563bb
Compare
src/background_updates/run/v1.rs
Outdated
/// Valid values are: | ||
/// populate_stats_process_rooms | ||
/// regenerate_directory | ||
pub job_name: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: wondering if we should struct the valid options here. but could be an over kill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, just define an enum with #[serde(rename_all = "snake_case")]
. Ruma also has a derive StringEnum
if you want to allow extra custom values while still having enum variants for the well-known strings (see other uses of that derive macro).
479196d
to
e7694fd
Compare
Signed-off-by: Hanadi92 <[email protected]>
Signed-off-by: Hanadi92 <[email protected]>
Signed-off-by: Hanadi92 <[email protected]>
531b647
to
4d05290
Compare
Following the docs from administration:
GET /_synapse/admin/v1/background_updates/status
POST /_synapse/admin/v1/background_updates/enabled
POST /_synapse/admin/v1/background_updates/start_job