1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-08-31 15:11:08 +00:00

Optimize copy and move file.

This commit is contained in:
cuihaikuo
2019-03-25 18:37:38 +08:00
parent da80c79e41
commit 2e41b60ab0
3 changed files with 287 additions and 207 deletions

View File

@@ -78,6 +78,8 @@ seaf_copy_manager_get_task (SeafCopyManager *mgr,
"canceled", task->canceled, "failed", task->failed,
"successful", task->successful,
NULL);
if (task->canceled || task->failed || task->successful)
g_hash_table_remove(priv->copy_tasks, task_id);
}
pthread_mutex_unlock (&priv->lock);
@@ -135,7 +137,6 @@ seaf_copy_manager_add_task (SeafCopyManager *mgr,
const char *dst_filename,
int replace,
const char *modifier,
gint64 total_files,
CopyTaskFunc function,
gboolean need_progress)
{
@@ -148,7 +149,6 @@ seaf_copy_manager_add_task (SeafCopyManager *mgr,
task_id = gen_uuid();
task = g_new0 (CopyTask, 1);
memcpy (task->task_id, task_id, 36);
task->total = total_files;
pthread_mutex_lock (&priv->lock);
g_hash_table_insert (priv->copy_tasks, g_strdup(task_id), task);