Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
tracker-miners
tracker-miners-bsc1165635-crawl-timestamp.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File tracker-miners-bsc1165635-crawl-timestamp.patch of Package tracker-miners
From fa426cc6ded71c8e548b074d3b47da4a87bdd968 Mon Sep 17 00:00:00 2001 From: Otto Hollmann <otto.hollmann@suse.com> Date: Fri, 6 Mar 2020 10:02:20 +0100 Subject: [PATCH] Fix return value of checking crawl interval and properly implement setting of last crawl time stamp. --- src/miners/fs/tracker-main.c | 2 +- src/miners/fs/tracker-miner-files.c | 30 ++++++++++++----------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c index 73a5d2d28..1c6a2e9c0 100644 --- a/src/miners/fs/tracker-main.c +++ b/src/miners/fs/tracker-main.c @@ -343,7 +343,7 @@ should_crawl (TrackerConfig *config, return FALSE; } else { g_message (" (More than) %d days after last crawling, enabled", crawling_interval); - return FALSE; + return TRUE; } } } diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c index 99c27c07f..36829354b 100644 --- a/src/miners/fs/tracker-miner-files.c +++ b/src/miners/fs/tracker-miner-files.c @@ -3493,9 +3493,7 @@ tracker_miner_files_get_last_crawl_done (void) /** * tracker_miner_files_set_last_crawl_done: * - * Set the status of the first full index of files. Should be set to - * %FALSE if the index was never done or if a reindex is needed. When - * the index is completed, should be set to %TRUE. + * Set the time stamp of the last full index of files. **/ void tracker_miner_files_set_last_crawl_done (gboolean done) @@ -3506,33 +3504,29 @@ tracker_miner_files_set_last_crawl_done (gboolean done) filename = get_last_crawl_filename (); already_exists = g_file_test (filename, G_FILE_TEST_EXISTS); - if (done && !already_exists) { + if (done) { GError *error = NULL; gchar *content; - content = g_strdup_printf ("%" G_GUINT64_FORMAT, (guint64) time (NULL)); - - /* If done, create stamp file if not already there */ + if (already_exists) { + g_info (" Overwriting last crawl file:'%s'", filename); + } else { + g_info (" Creating last crawl file:'%s'", filename); + } + /* Create/update time stamp file */ if (!g_file_set_contents (filename, content, -1, &error)) { - g_warning (" Could not create file:'%s' failed, %s", + g_warning (" Could not create/overwrite file:'%s' failed, %s", filename, error->message); g_error_free (error); } else { - g_info (" Last crawl file:'%s' created", filename); + g_info (" Last crawl file:'%s' updated", filename); } g_free (content); - } else if (!done && already_exists) { - /* If NOT done, remove stamp file */ - g_info (" Removing last crawl file:'%s'", filename); - - if (g_remove (filename)) { - g_warning (" Could not remove file:'%s': %m", - filename); - } + } else { + g_info (" Crawl not done yet, doesn't update last crawl file."); } - g_free (filename); } -- 2.25.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor