Skip to content

Commit

Permalink
Gandalf plugin need to yeild function if it is Future in healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rfloriano committed Aug 14, 2014
1 parent 40ed6f5 commit 162c968
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cow/plugins/gandalf_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import logging

from tornado.httpclient import AsyncHTTPClient
from tornado.concurrent import is_future
import tornado.gen as gen
import gandalf.tornado_cli as client

from cow.plugins import BasePlugin
Expand All @@ -27,8 +29,12 @@ def before_end(cls, application, *args, **kw):
del application.gandalf

@classmethod
def before_healthcheck(cls, application, callback, *args, **kw):
application.gandalf.healthcheck(callback=callback)
@gen.coroutine
def before_healthcheck(cls, application, *args, **kw):
result = application.gandalf.healthcheck()
if is_future(result):
result = yield result
raise gen.Return(result)

@classmethod
def validate(cls, result, *args, **kw):
Expand Down

0 comments on commit 162c968

Please sign in to comment.