Merge lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep into lp:ocb-server

Proposed by Ronald Portier (Therp)
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep
Merge into: lp:ocb-server
Diff against target: 31 lines (+12/-1)
1 file modified
openerp/service/__init__.py (+12/-1)
To merge this branch: bzr merge lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Disapprove
Review via email: mp+221357@code.launchpad.net

Description of the change

Prevent log from filling up with messages when there are difficulties ending all threads on server stop.

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Development for 7.0 has moved to github on https://github.com/OCA/ocb - please move your merge proposal there if it is still valid.

(I close and reject this in order to have a cleaner overview for 6.1 MPs which indeed have to be done on launchpad)

review: Disapprove

Unmerged revisions

5344. By Ronald Portier (Therp)

[FIX] Prevent filling up log with messages when there are difficulties
    ending all threads on server stop.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/service/__init__.py'
2--- openerp/service/__init__.py 2013-11-25 10:38:42 +0000
3+++ openerp/service/__init__.py 2014-05-29 11:14:34 +0000
4@@ -94,6 +94,14 @@
5 # Start the main cron thread.
6 cron.start_service()
7
8+def log_repeating_message(msg, counter):
9+ '''Utility function to log repeated messages, withouth overflowing log'''
10+ if (counter <= 10
11+ or (counter <= 100 and (counter % 10 == 0))
12+ or (counter <= 1000 and (counter % 100 == 0))
13+ or (counter > 1999 and (counter % 1000 == 0))):
14+ _logger.debug('%d: %s' % (counter, msg))
15+
16 def stop_services():
17 """ Stop all services. """
18 # stop services
19@@ -112,8 +120,11 @@
20 for thread in threading.enumerate():
21 _logger.debug('process %r (%r)', thread, thread.isDaemon())
22 if thread != me and not thread.isDaemon() and thread.ident != main_thread_id:
23+ msg_counter = 0
24+ msg = 'join and sleep %s' % thread.name
25 while thread.isAlive():
26- _logger.debug('join and sleep')
27+ msg_counter += 1
28+ log_repeating_message(msg, msg_counter)
29 # Need a busyloop here as thread.join() masks signals
30 # and would prevent the forced shutdown.
31 thread.join(0.05)

Subscribers

People subscribed via source and target branches

to status/vote changes: