Merge lp:~nataliabidart/ubuntuone-client/fix-803598 into lp:ubuntuone-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1031
Merged at revision: 1031
Proposed branch: lp:~nataliabidart/ubuntuone-client/fix-803598
Merge into: lp:ubuntuone-client
Diff against target: 74 lines (+13/-14)
1 file modified
ubuntuone/platform/windows/filesystem_notifications.py (+13/-14)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-client/fix-803598
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+66383@code.launchpad.net

Commit message

- Log smartly to avoid crowding the syncdaemon.log file (LP: #803598).

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 on code review

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/platform/windows/filesystem_notifications.py'
2--- ubuntuone/platform/windows/filesystem_notifications.py 2011-06-21 10:20:24 +0000
3+++ ubuntuone/platform/windows/filesystem_notifications.py 2011-06-29 20:34:28 +0000
4@@ -152,10 +152,9 @@
5 events_queue = Queue()
6 self.events_queue = events_queue
7
8-
9 @longpath(paths_indexes=[1])
10 def _path_is_dir(self, path):
11- """"Check if the path is a dir and update the local subdir list."""
12+ """Check if the path is a dir and update the local subdir list."""
13 self.log.debug('Testing if path "%s" is a dir', path)
14 is_dir = False
15 if os.path.exists(path):
16@@ -488,8 +487,10 @@
17
18
19 class Notifier(object):
20- """
21- Read notifications, process events. Inspired by the pyinotify.Notifier
22+ """Read notifications, process events.
23+
24+ Inspired by the pyinotify.Notifier.
25+
26 """
27
28 def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
29@@ -510,15 +511,14 @@
30 self._threshold = threshold
31 self._timeout = timeout
32
33+ self.log.debug('Processing events with threashold %s and timeout %s.',
34+ self._threshold, self._timeout)
35+
36 def proc_fun(self):
37 return self._default_proc_fun
38
39 def process_events(self):
40- """
41- Process the event given the threshold and the timeout.
42- """
43- self.log.debug('Processing events with threashold: %s and timeout: %s',
44- self._threshold, self._timeout)
45+ """Process the event given the threshold and the timeout."""
46 # we will process an amount of events equal to the threshold of
47 # the notifier and will block for the amount given by the timeout
48 processed_events = 0
49@@ -531,21 +531,20 @@
50 else:
51 raw_event = self._watch_manager.events_queue.get(
52 timeout=self._timeout)
53- self.log.debug('Raw event is %s.', raw_event)
54 watch = self._watch_manager.get_watch(raw_event.wd)
55 if watch is None:
56 # Not really sure how we ended up here, nor how we should
57 # handle these types of events and if it is appropriate to
58 # completly skip them (like we are doing here).
59- self.log.warning('Unable to retrieve Watch object '
60- + 'associated to %s', raw_event)
61+ self.log.warning('Unable to retrieve watch object for '
62+ 'raw event: %r', raw_event)
63 processed_events += 1
64 continue
65+ self.log.debug('Raw event is %r, watch is %r, proc_fun is %r.',
66+ raw_event, watch, watch.proc_fun)
67 if watch and watch.proc_fun:
68- self.log.debug('Executing proc_fun from watch.')
69 watch.proc_fun(raw_event) # user processings
70 else:
71- self.log.debug('Executing default_proc_fun')
72 self._default_proc_fun(raw_event)
73 processed_events += 1
74 except Empty:

Subscribers

People subscribed via source and target branches