After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 573834 - g_timeout_add_seconds should be preferred to g_timeout_add
g_timeout_add_seconds should be preferred to g_timeout_add
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: General
git master
Other All
: Normal minor
: ---
Assigned To: tracker-general
Jamie McCracken
Depends on:
Blocks:
 
 
Reported: 2009-03-02 22:55 UTC by Marcel Stimberg
Modified: 2009-03-16 17:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
substitute g_timeout_add by g_timeout_add_seconds (919 bytes, patch)
2009-03-02 22:56 UTC, Marcel Stimberg
needs-work Details | Review
substitute g_timeout_add by g_timeout_add_seconds (1.83 KB, patch)
2009-03-06 20:15 UTC, Marcel Stimberg
committed Details | Review

Description Marcel Stimberg 2009-03-02 22:55:26 UTC
Please describe the problem:
Although it is done correctly most of the time, g_timeout_add is used twice where g_timeout_add_seconds could be used instead (and correcting this might save the world: https://wiki.ubuntu.com/SavingTheWorld )


Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Patch is coming up...
Comment 1 Marcel Stimberg 2009-03-02 22:56:57 UTC
Created attachment 129897 [details] [review]
substitute g_timeout_add by g_timeout_add_seconds
Comment 2 Ivan Frade 2009-03-06 14:39:21 UTC
The patch is not complete. There are more calls to g_timeout_add in the code.
Comment 3 Marcel Stimberg 2009-03-06 20:05:53 UTC
Hi Ivan,
Ok, it seems I missed one call in trackerd/tracker-processor.c
Note that there are more calls - but I did not see any with multiples of 1000 - the patch is conservative in the sense that I do not want to decide wheter a g_timeout_add(500,...) should be replaced by g_timeout_add_seconds(1,...). I also excluded files in the tests directory.

$ svn update
At revision 3031.
$ find . -name '*.c'| xargs grep -E "g_timeout_add\ ?\("
./src/trackerd/tracker-main.c:			g_timeout_add (seconds * 1000, start_cb, NULL);
./src/trackerd/tracker-processor.c:		g_timeout_add (ITEMS_QUEUE_PROCESS_INTERVAL,
./src/trackerd/tracker-daemon.c:	g_timeout_add (500, (GSourceFunc) tracker_shutdown, NULL);
./src/tracker-indexer/tracker-indexer.c:		priv->cleanup_task_id = g_timeout_add (500, cleanup_task_func, indexer);
./src/tracker-applet/tracker-applet.c:			g_timeout_add (1000,
./tests/trackerd/xesam/gtestextensions.c:	g_timeout_add (millis, (GSourceFunc)gtx_quit_main_loop, recursive_main);
./tests/trackerd/xesam/gtestextensions.c:    max_timeout_id = g_timeout_add (max_wait_ms, (GSourceFunc)gtx_quit_main_loop,
./tests/trackerd/xesam/gtestextensions.c: *		  and failing; passed directly to g_timeout_add().
Comment 4 Marcel Stimberg 2009-03-06 20:15:09 UTC
Created attachment 130213 [details] [review]
substitute g_timeout_add by g_timeout_add_seconds

The patch now includes tracker-processor.c
Comment 5 Martyn Russell 2009-03-16 17:55:07 UTC
Thanks for the patch, committed! :)