mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-08-03 08:58:36 +02:00
Make Storage methods async
This will better support concurrent requests.
This commit is contained in:
parent
4de5c9a345
commit
7559364017
13 changed files with 597 additions and 412 deletions
|
@ -20,6 +20,7 @@ pub(crate) async fn service(
|
|||
if let Some((version_id, data)) = server_state
|
||||
.server
|
||||
.get_snapshot(client_id)
|
||||
.await
|
||||
.map_err(server_error_to_actix)?
|
||||
{
|
||||
Ok(HttpResponse::Ok()
|
||||
|
@ -48,9 +49,9 @@ mod test {
|
|||
|
||||
// set up the storage contents..
|
||||
{
|
||||
let mut txn = storage.txn(client_id).unwrap();
|
||||
txn.new_client(Uuid::new_v4()).unwrap();
|
||||
txn.commit().unwrap();
|
||||
let mut txn = storage.txn(client_id).await.unwrap();
|
||||
txn.new_client(Uuid::new_v4()).await.unwrap();
|
||||
txn.commit().await.unwrap();
|
||||
}
|
||||
|
||||
let server = WebServer::new(Default::default(), None, storage);
|
||||
|
@ -75,8 +76,8 @@ mod test {
|
|||
|
||||
// set up the storage contents..
|
||||
{
|
||||
let mut txn = storage.txn(client_id).unwrap();
|
||||
txn.new_client(Uuid::new_v4()).unwrap();
|
||||
let mut txn = storage.txn(client_id).await.unwrap();
|
||||
txn.new_client(Uuid::new_v4()).await.unwrap();
|
||||
txn.set_snapshot(
|
||||
Snapshot {
|
||||
version_id,
|
||||
|
@ -85,8 +86,9 @@ mod test {
|
|||
},
|
||||
snapshot_data.clone(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
txn.commit().unwrap();
|
||||
txn.commit().await.unwrap();
|
||||
}
|
||||
|
||||
let server = WebServer::new(Default::default(), None, storage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue