Changeset 3627

Show
Ignore:
Timestamp:
17/10/08 18:29:10 (3 months ago)
Author:
dmeyer
Message:

update signal handling for monitoring

Location:
trunk/beacon
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/beacon/bin/beacon-search

    r3625 r3627  
    143143        print 
    144144 
    145 def changed(result): 
     145def changed(result, details): 
    146146    print '\nBeacon query update:' 
    147147    print_results(result, details) 
     
    273273        result = yield kaa.beacon.query(**query) 
    274274         
     275    t2 = time.time() 
     276    print_results(result, details) 
     277    if not isinstance(result.get(), (list, tuple)): 
     278        result = [ result.get() ] 
     279    print 'Query took %s seconds; %d results' % ((t2-t1), len(result)) 
    275280    if not monitor: 
    276         t2 = time.time() 
    277         print_results(result, details) 
    278         if not isinstance(result.get(), (list, tuple)): 
    279             result = [ result.get() ] 
    280         print 'Query took %s seconds; %d results' % ((t2-t1), len(result)) 
    281281        sys.exit(0) 
    282     else: 
    283         result.signals['changed'].connect(changed, result) 
    284         result.signals['progress'].connect(progress) 
    285         result.signals['up-to-date'].connect(uptodate) 
    286         result.monitor() 
    287  
    288     kaa.main.run() 
    289     sys.exit(0) 
     282    result.signals['changed'].connect(changed, result, details) 
     283    result.signals['progress'].connect(progress) 
     284    result.signals['up-to-date'].connect(uptodate) 
     285    result.monitor() 
    290286 
    291287if __name__ == '__main__': 
  • trunk/beacon/src/server/monitor.py

    r3611 r3627  
    233233            yield False 
    234234 
    235         if not changed: 
    236             # no changes but send the 'changed' ipc to the client 
    237             self.notify_client('changed', False) 
    238             self._checking = False 
    239             yield False 
    240  
    241235        for pos, item in enumerate(changed): 
    242236            self.notify_client('progress', pos+1, len(changed), item.url) 
     
    261255            OneShotTimer(self.check, []).start(0.5) 
    262256        self.notify_client('checked') 
     257        self.notify_client('changed', True) 
    263258        self._checking = False 
    264259        yield False