Commit 71a1e822 authored by Philip Van Hoof's avatar Philip Van Hoof

miners/fs, tracker-extract: Use alarm() instead of GDBus' timeout

The alarm is reset after each document.

Fixes NB#282791.
parent a14567fb
......@@ -2192,7 +2192,7 @@ dbus_send_and_splice_async (GDBusConnection *connection,
g_dbus_connection_send_message_with_reply (connection,
message,
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
-1,
G_MAXINT, /* timeout is enforced by an alarm() in tracker-extract */
NULL,
cancellable,
send_and_splice_dbus_callback,
......
......@@ -335,6 +335,9 @@ reset_shutdown_timeout (TrackerController *controller)
TrackerControllerPrivate *priv;
GSource *source;
/* Reset alarm of the process too */
tracker_main_timeout_reset ();
priv = controller->priv;
if (priv->shutdown_timeout == 0) {
......
......@@ -254,6 +254,20 @@ tracker_main_get_config (void)
return config;
}
void
tracker_main_timeout_reset (void)
{
#ifndef G_OS_WIN32
/* This replaces the default timeout of the gdbus call in miner-fs at
* dbus_send_and_splice_async (it puts control of the timeout in the hands
* of this process). In GDBus the default timeout when using -1 is
* 25*1000 msec (gdbusconnection.c at g_dbus_connection_send_message_
* with_reply_unlocked), so 25 seconds. */
alarm (25);
#endif /* G_OS_WIN32 */
}
static int
run_standalone (void)
{
......@@ -436,6 +450,9 @@ main (int argc, char *argv[])
tracker_locale_init ();
tracker_albumart_init ();
/* Set initial alarm timeout */
tracker_main_timeout_reset ();
/* Main loop */
main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (main_loop);
......
......@@ -28,7 +28,7 @@ G_BEGIN_DECLS
/* This is used to not shutdown after the default of 30 seconds if we
* get more work to do.
*/
void tracker_main_quit_timeout_reset (void);
void tracker_main_timeout_reset (void);
/* Enables getting the config object from extractors */
TrackerConfig *tracker_main_get_config (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment