fix to oysterd config

This commit is contained in:
James Turk 2011-08-02 16:12:05 -04:00
parent 71afc7074b
commit f5e463e366

View File

@ -66,12 +66,14 @@ def main():
help='retry wait period (seconds) when making requests (default: 5)') help='retry wait period (seconds) when making requests (default: 5)')
args = parser.parse_args() args = parser.parse_args()
work_queue = multiprocessing.JoinableQueue()
# workers defaults to cpu_count # workers defaults to cpu_count
if not args.workers: if not args.workers:
args.workers = multiprocessing.cpu_count() args.workers = multiprocessing.cpu_count()
workers = [UpdateProcess(work_queue) for i in xrange(args.workers)] workers = [UpdateProcess(work_queue) for i in xrange(args.workers)]
work_queue = multiprocessing.JoinableQueue()
# separate process for Flask app
def flask_process(): def flask_process():
app.run(debug=args.debug, port=args.port) app.run(debug=args.debug, port=args.port)
server = multiprocessing.Process(target=flask_process) server = multiprocessing.Process(target=flask_process)
@ -79,11 +81,20 @@ def main():
# give flask access to our work_queue # give flask access to our work_queue
app.work_queue = work_queue app.work_queue = work_queue
# start all processes
for worker in workers: for worker in workers:
worker.start() worker.start()
server.start() server.start()
client = Client() client = Client(mongo_host=args.mongo_host,
mongo_port=args.mongo_port,
mongo_db=args.mongo_db,
mongo_log_maxsize=args.logsize,
user_agent=args.useragent,
rpm=args.rpm,
timeout=args.timeout,
retry_attempts=args.retry_attempts,
retry_wait_seconds=args.retry_wait_seconds)
while True: while True:
# get everything overdue and put it into the queue # get everything overdue and put it into the queue