base: Use Instant instead of SystemTime for wasm compatibility
This commit is contained in:
parent
b83399ba14
commit
cb12bc1584
2 changed files with 6 additions and 8 deletions
|
@ -20,7 +20,6 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
result::Result as StdResult,
|
||||
sync::Arc,
|
||||
time::SystemTime,
|
||||
};
|
||||
|
||||
use matrix_sdk_common::{
|
||||
|
@ -36,6 +35,7 @@ use matrix_sdk_common::{
|
|||
AnyToDeviceEvent, EventContent, StateEvent,
|
||||
},
|
||||
identifiers::{RoomId, UserId},
|
||||
instant::Instant,
|
||||
locks::RwLock,
|
||||
Raw,
|
||||
};
|
||||
|
@ -701,7 +701,7 @@ impl BaseClient {
|
|||
return Ok(SyncResponse::new(response.next_batch));
|
||||
}
|
||||
|
||||
let now = SystemTime::now();
|
||||
let now = Instant::now();
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
let to_device = {
|
||||
|
@ -892,7 +892,7 @@ impl BaseClient {
|
|||
*self.sync_token.write().await = Some(response.next_batch.clone());
|
||||
self.apply_changes(&changes).await;
|
||||
|
||||
info!("Processed a sync response in {:?}", now.elapsed().unwrap());
|
||||
info!("Processed a sync response in {:?}", now.elapsed());
|
||||
|
||||
let response = SyncResponse {
|
||||
next_batch: response.next_batch,
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::{
|
||||
sync::{Arc, RwLock},
|
||||
time::SystemTime,
|
||||
};
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use dashmap::{DashMap, DashSet};
|
||||
use matrix_sdk_common::{
|
||||
|
@ -26,6 +23,7 @@ use matrix_sdk_common::{
|
|||
AnyBasicEvent, AnyStrippedStateEvent, AnySyncStateEvent, EventContent, EventType,
|
||||
},
|
||||
identifiers::{RoomId, UserId},
|
||||
instant::Instant,
|
||||
};
|
||||
|
||||
use tracing::info;
|
||||
|
@ -91,7 +89,7 @@ impl MemoryStore {
|
|||
}
|
||||
|
||||
pub async fn save_changes(&self, changes: &StateChanges) -> Result<()> {
|
||||
let now = SystemTime::now();
|
||||
let now = Instant::now();
|
||||
|
||||
if let Some(s) = &changes.sync_token {
|
||||
*self.sync_token.write().unwrap() = Some(s.to_owned());
|
||||
|
|
Loading…
Reference in a new issue