[cogen] Re: Quick cogen question

3 views
Skip to first unread message

Ionel Maries Cristian

unread,
May 3, 2010, 1:28:01 PM5/3/10
to Torbjorn Kristoffersen, co...@googlegroups.com
Hey,

You forgot the "yield" from the WaitForSignal op. The code should be:


def myaction(self):
    yield request.environ['cogen.core'].events.WaitForSignal("abc", timeout=5)
    if isinstance(request.environ['cogen.wsgi'].result, Exception):
        yield "Timed out..."
    else:
        yield "Got signal %s" % request.environ['cogen.wsgi'].result

Please use the mailing list for further inquires.

-- ionel

On Mon, May 3, 2010 at 13:32, Torbjorn Kristoffersen <torb...@gmail.com> wrote:
Hi Ionel, I hope you have time to answer a simple Cogen question for me.

I'm using Pylons and I want to do something like this within a controller:


def myaction(self):
    request.environ['cogen.core'].events.WaitForSignal("abc", timeout=5)
    if isinstance(request.environ['cogen.wsgi'].result, Exception):
        yield "Timed out..."
    else:
        yield "Got signal %s" % request.environ['cogen.wsgi'].result


I will later rely on another coro to fire the signal 'abc'.  But right now nobody is firing that signal, but it still goes directly to:

    "Got signal None"

My expected behavior is that it will wait for 5 seconds (since the timeout is 5) and then go "Timed out".

Any idea what I am doing wrong?

Kind regards,
Torbjorn

--
You received this message because you are subscribed to the Google Groups "cogen" group.
To post to this group, send email to co...@googlegroups.com.
To unsubscribe from this group, send email to cogen+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cogen?hl=en.
Reply all
Reply to author
Forward
0 new messages