diff --git a/src/media_delivery/media_download.c b/src/media_delivery/media_download.c index 0a172d8b..20e009d7 100644 --- a/src/media_delivery/media_download.c +++ b/src/media_delivery/media_download.c @@ -264,7 +264,7 @@ int md_dl_check_stall(struct media_download* dl, uint64_t now_tb) { if (b->state != MD_BLK_REQ && b->state != MD_BLK_RECV) continue; if (now_tb - b->last_progress_tb >= stall) { DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "%s: STALL blk=%d state=%d no progress %llums", - MDL_ID, bi, b->state, (unsigned long long)(now_tb - b->last_progress_tb)); + MDL_ID, bi, b->state, (unsigned long long)((now_tb - b->last_progress_tb) / 10)); if (md_dl_failover_block(dl, bi, now_tb) < 0) return -1; } } @@ -354,6 +354,7 @@ void md_dl_conn_cb(struct CONN_MGR_HANDLE* h, uint64_t node_id, uint64_t group_i if (b->state == MD_BLK_CONN && b->holder_idx >= 0 && b->holder_idx < b->num_holders && b->holders[b->holder_idx] == node_id) { b->state = MD_BLK_REQ; + b->last_progress_tb = get_time_tb(); /* соединение только поднялось — обнуляем простой */ md_dl_send_block_req(dl->inst, node_id, dl, bi); } } diff --git a/src/media_delivery/media_index.c b/src/media_delivery/media_index.c index c8a5bf54..e5e143d5 100644 --- a/src/media_delivery/media_index.c +++ b/src/media_delivery/media_index.c @@ -24,7 +24,7 @@ static int mi_insert(sqlite3* db, int64_t timestamp, int64_t file_size, int64_t chunk_size, int chunk, int64_t offset) { const char* sql = - "INSERT INTO media_files(media_id,block_id,content_hash,chat_id,location," + "INSERT OR IGNORE INTO media_files(media_id,block_id,content_hash,chat_id,location," "node_id,node_sign,timestamp,file_size,chunk_size,chunk,offset)" " VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";