Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 5034cd8a rédigé par Kubat's avatar Kubat
Parcourir les fichiers

REPO: Update the unix ts to set it to the repo's one even if the kara is...

REPO: Update the unix ts to set it to the repo's one even if the kara is ignored in the update process
parent fd3038f1
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!192Resolve "FEATURE: Use time stamp from kurisu in update process"
......@@ -396,6 +396,20 @@ ___handle_got_json_dl(struct kara *kara)
kara->filename);
}
PRIVATE_FUNCTION void
___update_repo_timestamp_if_needed_on_ignore_kara(struct kara *kara, uint64_t repo_ts)
{
uint64_t stored_ts = 0;
const bool found_ts = database_get_kara_repo_timestamp_id(kara->db, (int)kara->id, &stored_ts);
if ((!found_ts) || (stored_ts <= 0)) {
LOG_INFO("REPO",
"Update repo unix timestamp of kara %ld because it was "
"not present in the DB (update of the DB scheme)",
kara->id);
database_set_kara_repo_timestamp_id(kara->db, (int)kara->id, repo_ts);
}
}
PRIVATE_FUNCTION int
___handle_got_json_internal_callback(const char *key, const char *val, int comp, void *user)
{
......@@ -514,10 +528,8 @@ ___handle_got_json_internal_callback(const char *key, const char *val, int comp,
/* Ignore kara */
else {
++(kara->ignored_count);
/* Don't burn the disk */
___sleep();
___update_repo_timestamp_if_needed_on_ignore_kara(kara, (uint64_t)kara->unix_timestamp);
___sleep(); /* Don't burn the disk */
lkt_queue_send(kara->repo->queue, LKT_EVENT_TOUCH_KARA, (void *)(size_t)kara->id);
lkt_queue_send(kara->repo->queue, LKT_EVENT_DB_UPDATE_TICK, NULL);
LOG_DEBUG("REPO", "Ignore kara %ld", kara->id);
......@@ -527,6 +539,7 @@ ___handle_got_json_internal_callback(const char *key, const char *val, int comp,
do_it:
/* Even if we must download the kara, the user could have filtered it out! */
if (lkt_uri_match_kara_metadata(filter, &kara->mdt, kara->db, (int)kara->id)) {
___update_repo_timestamp_if_needed_on_ignore_kara(kara, (uint64_t)kara->unix_timestamp);
LOG_DEBUG("REPO", "The kara %ld is ignored because it was filtered out", kara->id);
++(kara->ignored_count);
return 0;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter