Fix unlock file error and only record sync error (#2772)

* Fix unlock file error and only record sync error

* Check folder perms and file locks immediately

---------

Co-authored-by: yangheran <heran.yang@seafile.com>
This commit is contained in:
feiniks 2024-05-16 16:38:53 +08:00 committed by GitHub
parent d6d8954e87
commit 81a9e1cd57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -534,7 +534,7 @@ handle_file_lock (json_t *content)
if (seaf_filelock_manager_get_lock_status (seaf->filelock_mgr, repo_id, path) == FILE_NOT_LOCKED) {
return 0;
}
seaf_filelock_manager_mark_file_unlocked (seaf->filelock_mgr, repo_id, path);
seaf_filelock_manager_unlock_file (seaf->filelock_mgr, repo_id, path);
}
return 0;

View File

@ -5321,8 +5321,8 @@ download_files_http (const char *repo_id,
// Record a file-level sync error when failed to checkout file.
if (rc == FETCH_CHECKOUT_FAILED) {
if (checkout_file_failed) {
send_file_sync_error_notification (repo_id, http_task->repo_name, de->name,
SYNC_ERROR_ID_CHECKOUT_FILE);
seaf_repo_manager_record_sync_error (repo_id, http_task->repo_name, de->name,
SYNC_ERROR_ID_CHECKOUT_FILE);
} else {
checkout_file_failed = TRUE;
send_file_sync_error_notification (repo_id, http_task->repo_name, de->name,

View File

@ -2178,6 +2178,12 @@ check_folder_permissions_one_server (SeafSyncManager *mgr,
server_state->checking_folder_perms)
return;
if (server_state->immediate_check_folder_perms) {
server_state->immediate_check_folder_perms = FALSE;
check_folder_permissions_one_server_immediately (mgr, host, server_state, repos, TRUE);
return;
}
if (server_state->last_check_perms_time > 0 &&
now - server_state->last_check_perms_time < CHECK_FOLDER_PERMS_INTERVAL)
return;
@ -2322,6 +2328,12 @@ check_locked_files_one_server (SeafSyncManager *mgr,
server_state->checking_locked_files)
return;
if (server_state->immediate_check_locked_files) {
server_state->immediate_check_locked_files = FALSE;
check_locked_files_one_server_immediately (mgr, host, server_state, repos, TRUE);
return;
}
if (server_state->last_check_locked_files_time > 0 &&
now - server_state->last_check_locked_files_time < CHECK_FOLDER_PERMS_INTERVAL)
return;