Skip to content

self cancelling watcher #110

@mckenziec

Description

@mckenziec
  • etcd3-py version: latest
  • Python version: 2.7.5
  • Operating System: CENTOS 7.5

Description

Maybe this is a Python thing I can work out, but I'm trying to have a watcher that'll self cancel within an event callback. Like watch once, or watch until some condition is satisfied, then cancel itself.

I've designed a kind of request/approval protocol on top of etcd and I'd like the watch to end when my approval watch fires. Any suggestions?

Excellent, stable library BTW. Thanks!

What I Did

            def watch_apr(ev):
                k = ev.key
                v = ev.value
                # cancel here somehow

            apr_watcher.onEvent(EventType.PUT, watch_apr)
            apr_watcher.runDaemon()
            while apr_watcher <> None:
                time.sleep(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions