示例#1
0
def update(d):
    # fire first
    t = tree.Tree(d)
    #print 'live', waiters.live_signals
    for key in [key for key in waiters.live_signals if tree.keyin(key, d)]:
        fd = {}
        for ks, x in t.find(key):
            fd[','.join(ks)] = x.value
        #print 'fire', key, fd
        waiters.send(key, fd)

    # update
    _tree.merge(d)
示例#2
0
def update(d):
    # fire first
    t = tree.Tree(d)
    #print 'live', waiters.live_signals
    for key in [key for key in waiters.live_signals if tree.keyin(key, d)]:
        fd = {}
        for ks, x in t.find(key):
            fd[','.join(ks)] = x.value
        #print 'fire', key, fd
        waiters.send(key, fd)

    # update
    _tree.merge(d)
示例#3
0
文件: core.py 项目: Lax/Sloth
def update(d):
    lived = [key for key in waiters.live_signals if tree.keyin(key, d)]
    #print 'live', waiters.live_signals, lived
    for key in lived:
        fd = {}
        for ks, x in tree.query(d, key):
            fd[','.join(ks)] = x
        #print 'fire', key, fd
        waiters.send(key, fd)

    # update
    #print 'update:', d
    tree.merge(_tree, d)

    # need dump tree?
    global _last_update, _last_dump
    now = time.time()
    if _last_dump is None or now - _last_dump > dump_interval:
        tick_later()
    _last_update = time.time()