Fix lost separation caused by comment width change (#4739)

* Update post_view.rs

* Update structs.rs

* Update worker.rs

* Update worker.rs
This commit is contained in:
dullbananas 2024-05-23 11:05:35 -07:00 committed by GitHub
parent 69bdcb3069
commit ec77c00ef8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -652,7 +652,7 @@ impl<'a> PostQuery<'a> {
pool: &mut DbPool<'_>, pool: &mut DbPool<'_>,
) -> Result<Option<PostQuery<'a>>, Error> { ) -> Result<Option<PostQuery<'a>>, Error> {
// first get one page for the most popular community to get an upper bound for the page end for // first get one page for the most popular community to get an upper bound for the page end for
// the real query the reason this is needed is that when fetching posts for a single // the real query. the reason this is needed is that when fetching posts for a single
// community PostgreSQL can optimize the query to use an index on e.g. (=, >=, >=, >=) and // community PostgreSQL can optimize the query to use an index on e.g. (=, >=, >=, >=) and
// fetch only LIMIT rows but for the followed-communities query it has to query the index on // fetch only LIMIT rows but for the followed-communities query it has to query the index on
// (IN, >=, >=, >=) which it currently can't do at all (as of PG 16). see the discussion // (IN, >=, >=, >=) which it currently can't do at all (as of PG 16). see the discussion

View file

@ -113,7 +113,7 @@ pub struct PostReportView {
} }
/// currently this is just a wrapper around post id, but should be seen as opaque from the client's /// currently this is just a wrapper around post id, but should be seen as opaque from the client's
/// perspective stringified since we might want to use arbitrary info later, with a P prepended to /// perspective. stringified since we might want to use arbitrary info later, with a P prepended to
/// prevent ossification (api users love to make assumptions (e.g. parse stuff that looks like /// prevent ossification (api users love to make assumptions (e.g. parse stuff that looks like
/// numbers as numbers) about apis that aren't part of the spec /// numbers as numbers) about apis that aren't part of the spec
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]

View file

@ -37,8 +37,8 @@ use tokio_util::sync::CancellationToken;
use tracing::{debug, info, trace, warn}; use tracing::{debug, info, trace, warn};
/// Check whether to save state to db every n sends if there's no failures (during failures state is /// Check whether to save state to db every n sends if there's no failures (during failures state is
/// saved after every attempt) This determines the batch size for loop_batch. After a batch ends and /// saved after every attempt). This determines the batch size for loop_batch. After a batch ends
/// SAVE_STATE_EVERY_TIME has passed, the federation_queue_state is updated in the DB. /// and SAVE_STATE_EVERY_TIME has passed, the federation_queue_state is updated in the DB.
static CHECK_SAVE_STATE_EVERY_IT: i64 = 100; static CHECK_SAVE_STATE_EVERY_IT: i64 = 100;
/// Save state to db after this time has passed since the last state (so if the server crashes or is /// Save state to db after this time has passed since the last state (so if the server crashes or is
/// SIGKILLed, less than X seconds of activities are resent) /// SIGKILLed, less than X seconds of activities are resent)
@ -161,7 +161,9 @@ impl InstanceWorker {
id id
} else { } else {
// this is the initial creation (instance first seen) of the federation queue for this // this is the initial creation (instance first seen) of the federation queue for this
// instance skip all past activities: // instance
// skip all past activities:
self.state.last_successful_id = Some(latest_id); self.state.last_successful_id = Some(latest_id);
// save here to ensure it's not read as 0 again later if no activities have happened // save here to ensure it's not read as 0 again later if no activities have happened
self.save_and_send_state(pool).await?; self.save_and_send_state(pool).await?;