Example #1
0
 def add(self, **spec):
     spec = dict(Source.defaults(spec))
     if 'event' not in spec:
         sync = True
         spec['event'] = threading.Event()
     else:
         sync = False
     self.cache[spec['target']] = Source(self.ndb, **spec).start()
     if sync:
         self.cache[spec['target']].event.wait()
     return self.cache[spec['target']]
Example #2
0
 def add(self, **spec):
     spec = dict(Source.defaults(spec))
     if 'event' not in spec:
         sync = True
         spec['event'] = threading.Event()
     else:
         sync = False
     self.cache[spec['target']] = Source(self.ndb, **spec).start()
     if sync:
         self.cache[spec['target']].event.wait()
     return self.cache[spec['target']]
Example #3
0
 def async_add(self, **spec):
     spec = dict(Source.defaults(spec))
     self.cache[spec['target']] = Source(self.ndb, **spec).start()
     return self.cache[spec['target']]