Refactor counter increment sites for TwoPhaseCounter.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -160,7 +160,7 @@ pub(crate) async fn build_sync_events(
|
||||
) -> Result<sync_events::v3::Response, RumaResponse<UiaaResponse>> {
|
||||
let (sender_user, sender_device) = body.sender();
|
||||
|
||||
let next_batch = services.globals.current_count()?;
|
||||
let next_batch = services.globals.current_count();
|
||||
let since = body
|
||||
.body
|
||||
.since
|
||||
|
||||
@@ -74,7 +74,7 @@ pub(crate) async fn sync_events_v5_route(
|
||||
// Setup watchers, so if there's no response, we can wait for them
|
||||
let watcher = services.sync.watch(sender_user, sender_device);
|
||||
|
||||
let next_batch = services.globals.next_count()?;
|
||||
let next_batch = services.globals.next_count();
|
||||
|
||||
let conn_id = body.conn_id.clone();
|
||||
|
||||
@@ -136,7 +136,7 @@ pub(crate) async fn sync_events_v5_route(
|
||||
.chain(all_invited_rooms.clone())
|
||||
.chain(all_knocked_rooms.clone());
|
||||
|
||||
let pos = next_batch.clone().to_string();
|
||||
let pos = next_batch.to_string();
|
||||
|
||||
let mut todo_rooms: TodoRooms = BTreeMap::new();
|
||||
|
||||
@@ -146,7 +146,7 @@ pub(crate) async fn sync_events_v5_route(
|
||||
|
||||
let e2ee = collect_e2ee(services, sync_info, all_joined_rooms.clone());
|
||||
|
||||
let to_device = collect_to_device(services, sync_info, next_batch).map(Ok);
|
||||
let to_device = collect_to_device(services, sync_info, *next_batch).map(Ok);
|
||||
|
||||
let receipts = collect_receipts(services).map(Ok);
|
||||
|
||||
@@ -189,7 +189,7 @@ pub(crate) async fn sync_events_v5_route(
|
||||
response.rooms = process_rooms(
|
||||
services,
|
||||
sender_user,
|
||||
next_batch,
|
||||
*next_batch,
|
||||
all_invited_rooms.clone(),
|
||||
&todo_rooms,
|
||||
&mut response,
|
||||
|
||||
@@ -41,7 +41,6 @@ pub(crate) async fn send_event_to_device_route(
|
||||
map.insert(target_device_id_maybe.clone(), event.clone());
|
||||
let mut messages = BTreeMap::new();
|
||||
messages.insert(target_user_id.clone(), map);
|
||||
let count = services.globals.next_count()?;
|
||||
|
||||
let mut buf = EduBuf::new();
|
||||
serde_json::to_writer(
|
||||
@@ -49,7 +48,7 @@ pub(crate) async fn send_event_to_device_route(
|
||||
&federation::transactions::edu::Edu::DirectToDevice(DirectDeviceContent {
|
||||
sender: sender_user.to_owned(),
|
||||
ev_type: body.event_type.clone(),
|
||||
message_id: count.to_string().into(),
|
||||
message_id: services.globals.next_count().to_string().into(),
|
||||
messages,
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user