File tree Expand file tree Collapse file tree
syncstorage-postgres/src/db Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,3 +374,20 @@ async fn test_append_async_w_empty_string() -> Result<(), DbError> {
374374 } )
375375 . await
376376}
377+
378+ #[ tokio:: test]
379+ async fn pretouch ( ) -> Result < ( ) , DbError > {
380+ let settings = Settings :: test_settings ( ) . syncstorage ;
381+ with_test_transaction ( settings, async |db : & mut dyn Db < Error = DbError > | {
382+ let uid = 1 ;
383+ let coll = "clients" ;
384+ db. delete_storage ( hid ( uid) ) . await ?;
385+ let _batch = db. create_batch ( cb ( uid, coll, vec ! [ ] ) ) . await ?;
386+ // client with no timestamp (or PRETOUCH on some backends) should act as if
387+ // no timestamp exists
388+ let ts = db. get_storage_timestamp ( hid ( uid) ) . await ?;
389+ assert_eq ! ( ts, SyncTimestamp :: zero( ) ) ;
390+ Ok ( ( ) )
391+ } )
392+ . await
393+ }
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ impl Db for PgDb {
9898 . select ( user_collections:: modified)
9999 . filter ( user_collections:: user_id. eq ( user_id) )
100100 . filter ( user_collections:: collection_id. eq ( collection_id) )
101+ . filter ( user_collections:: modified. gt ( PRETOUCH_DT ) )
101102 . for_share ( )
102103 . first ( & mut self . conn )
103104 . await
@@ -235,6 +236,7 @@ impl Db for PgDb {
235236 let modified = user_collections:: table
236237 . select ( max ( user_collections:: modified) )
237238 . filter ( user_collections:: user_id. eq ( params. legacy_id as i64 ) )
239+ . filter ( user_collections:: modified. gt ( PRETOUCH_DT ) )
238240 . first :: < Option < _ > > ( & mut self . conn )
239241 . await ?
240242 . unwrap_or_else ( SyncTimestamp :: zero) ;
You can’t perform that action at this time.
0 commit comments