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 751119 - e-source-registry-server: Watch for changes to .source files and reload
e-source-registry-server: Watch for changes to .source files and reload
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2015-06-17 16:08 UTC by Philip Withnall
Modified: 2015-06-19 07:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
e-source-registry-server: Watch for changes to .source files and reload (2.62 KB, patch)
2015-06-17 16:08 UTC, Philip Withnall
committed Details | Review
e-source-registry-server: Remove a spurious newline from a debug message (968 bytes, patch)
2015-06-17 16:08 UTC, Philip Withnall
committed Details | Review
e-source-registry-server: Watch for changes to .source files and reload (2.64 KB, patch)
2015-06-19 07:46 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2015-06-17 16:08:35 UTC
See the description in the first patch.
Comment 1 Philip Withnall 2015-06-17 16:08:38 UTC
Created attachment 305490 [details] [review]
e-source-registry-server: Watch for changes to .source files and reload

It is possible for evolution-source-registry to detect a newly-added
source file before the author of the file has written to it; the
registry will attempt to load the file, find it is invalid, and then
ignore it.

The registry should also listen for changes to files, and reload them
accordingly. This means that the source file will get reloaded after the
author has finished writing to it, and hence the source will get
created.
Comment 2 Philip Withnall 2015-06-17 16:08:42 UTC
Created attachment 305491 [details] [review]
e-source-registry-server: Remove a spurious newline from a debug message
Comment 3 Milan Crha 2015-06-18 17:39:33 UTC
Review of attachment 305491 [details] [review]:

This one looks fine, I'll make more tests with the other first.
Comment 4 Milan Crha 2015-06-18 17:54:55 UTC
Review of attachment 305490 [details] [review]:

Please fix the things below and commit. Thanks.

::: libebackend/e-source-registry-server.c
@@ +426,3 @@
+	uri = g_file_get_uri (file);
+	g_debug ("Handling file monitor event %u for URI: %s", event_type, uri);
+	g_free (uri);

I do not like to see the allocation and free of the uri even for cases when the logging is disabled. Also, please use e_source_registry_debug_print(), rather than the g_debug(). You can use e_source_registry_debug_enabled() for the allocation part too.

@@ +452,3 @@
+			event_type = G_FILE_MONITOR_EVENT_CREATED;
+		} else if (!e_server_side_source_load (E_SERVER_SIDE_SOURCE (source),
+		                                       NULL, &error)) {

make it one "not so long" line, please

@@ +455,3 @@
+			uri = g_file_get_uri (file);
+			g_warning ("Error reloading source ‘%s’: %s",
+			           uri, error->message);

similar here, no need to wrap here
Comment 5 Philip Withnall 2015-06-19 07:39:07 UTC
Comment on attachment 305491 [details] [review]
e-source-registry-server: Remove a spurious newline from a debug message

Attachment 305491 [details] pushed as 8358fc9 - e-source-registry-server: Remove a spurious newline from a debug message
Comment 6 Philip Withnall 2015-06-19 07:46:15 UTC
The following fix has been pushed:
16c8cb4 e-source-registry-server: Watch for changes to .source files and reload
Comment 7 Philip Withnall 2015-06-19 07:46:19 UTC
Created attachment 305642 [details] [review]
e-source-registry-server: Watch for changes to .source files and reload

It is possible for evolution-source-registry to detect a newly-added
source file before the author of the file has written to it; the
registry will attempt to load the file, find it is invalid, and then
ignore it.

The registry should also listen for changes to files, and reload them
accordingly. This means that the source file will get reloaded after the
author has finished writing to it, and hence the source will get
created.