CC-2784: Stopping rabbitmq-server causes pypo CPU usage to increase dramatically
-fixed
This commit is contained in:
parent
b2db168a10
commit
6dab211a12
5 changed files with 39 additions and 23 deletions
|
@ -17,13 +17,13 @@ DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
|||
PIDFILE=/var/run/airtime-media-monitor.pid
|
||||
|
||||
start () {
|
||||
#monit monitor airtime-media-monitor >/dev/null 2>&1
|
||||
monit monitor airtime-media-monitor >/dev/null 2>&1
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||
}
|
||||
|
||||
stop () {
|
||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||
#monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
||||
monit unmonitor airtime-media-monitor >/dev/null 2>&1
|
||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
|
|
@ -2,14 +2,9 @@ import socket
|
|||
import logging
|
||||
import time
|
||||
|
||||
|
||||
import pyinotify
|
||||
from pyinotify import ProcessEvent
|
||||
|
||||
# For RabbitMQ
|
||||
from kombu.connection import BrokerConnection
|
||||
from kombu.messaging import Exchange, Queue, Consumer, Producer
|
||||
|
||||
from airtimemetadata import AirtimeMetadata
|
||||
from airtimefilemonitor.mediaconfig import AirtimeMediaConfig
|
||||
|
||||
|
@ -186,8 +181,10 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
self.mmc.touch_index_file()
|
||||
|
||||
self.file_events = []
|
||||
#yeild to workder thread
|
||||
|
||||
#yield to worker thread
|
||||
time.sleep(0)
|
||||
|
||||
#use items() because we are going to be modifying this
|
||||
#dictionary while iterating over it.
|
||||
for k, pair in self.cookies_IN_MOVED_FROM.items():
|
||||
|
@ -206,7 +203,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
self.handle_removed_file(False, event.pathname)
|
||||
|
||||
|
||||
#check for any events recieved from Airtime.
|
||||
#check for any events received from Airtime.
|
||||
try:
|
||||
notifier.connection.drain_events(timeout=0.1)
|
||||
#avoid logging a bunch of timeout messages.
|
||||
|
@ -214,4 +211,5 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
pass
|
||||
except Exception, e:
|
||||
self.logger.info("%s", e)
|
||||
time.sleep(3)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue