update dirmod as files added during sync
This commit is contained in:
parent
93ddc749c0
commit
e0511c560b
@ -4,7 +4,7 @@
|
|||||||
use crate::err::{AnkiError, Result, SyncErrorKind};
|
use crate::err::{AnkiError, Result, SyncErrorKind};
|
||||||
use crate::media::database::{MediaDatabaseContext, MediaDatabaseMetadata, MediaEntry};
|
use crate::media::database::{MediaDatabaseContext, MediaDatabaseMetadata, MediaEntry};
|
||||||
use crate::media::files::{
|
use crate::media::files::{
|
||||||
add_file_from_ankiweb, data_for_file, normalize_filename, remove_files, AddedFile,
|
add_file_from_ankiweb, data_for_file, mtime_as_i64, normalize_filename, remove_files, AddedFile,
|
||||||
};
|
};
|
||||||
use crate::media::{register_changes, MediaManager};
|
use crate::media::{register_changes, MediaManager};
|
||||||
use crate::version;
|
use crate::version;
|
||||||
@ -24,7 +24,6 @@ static SYNC_MAX_FILES: usize = 25;
|
|||||||
static SYNC_MAX_BYTES: usize = (2.5 * 1024.0 * 1024.0) as usize;
|
static SYNC_MAX_BYTES: usize = (2.5 * 1024.0 * 1024.0) as usize;
|
||||||
static SYNC_SINGLE_FILE_MAX_BYTES: usize = 100 * 1024 * 1024;
|
static SYNC_SINGLE_FILE_MAX_BYTES: usize = 100 * 1024 * 1024;
|
||||||
|
|
||||||
// fixme: dir mod handling when downloading files in a sync
|
|
||||||
// fixme: concurrent modifications during upload step
|
// fixme: concurrent modifications during upload step
|
||||||
|
|
||||||
/// The counts are not cumulative - the progress hook should accumulate them.
|
/// The counts are not cumulative - the progress hook should accumulate them.
|
||||||
@ -134,6 +133,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then update the DB
|
// then update the DB
|
||||||
|
let dirmod = mtime_as_i64(&self.mgr.media_folder)?;
|
||||||
self.ctx.transact(|ctx| {
|
self.ctx.transact(|ctx| {
|
||||||
record_removals(ctx, &to_delete)?;
|
record_removals(ctx, &to_delete)?;
|
||||||
record_additions(ctx, downloaded)?;
|
record_additions(ctx, downloaded)?;
|
||||||
@ -141,6 +141,7 @@ where
|
|||||||
|
|
||||||
// update usn
|
// update usn
|
||||||
meta.last_sync_usn = last_usn;
|
meta.last_sync_usn = last_usn;
|
||||||
|
meta.folder_mtime = dirmod;
|
||||||
ctx.set_meta(&meta)?;
|
ctx.set_meta(&meta)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user