Пример #1
0
 def performer_with_connection(intent):
     try:
         if self.connection:
             # Reuse already opened connection
             try:
                 return (yield AsyncFunc(async_performer(intent)))
             except BackendConnectionError:
                 # The connection has been closed, try to reconnect
                 # and rerun the performer
                 yield AsyncFunc(self.connection.close_connection())
                 self.connection = None
                 return (yield performer_with_connection(intent))
         else:
             # Open new connection and run command
             identity = yield Effect(EIdentityGet())
             connection = BackendConnection(self.url, self.watchdog)
             yield AsyncFunc(connection.open_connection(identity))
             self.connection = connection
             return (yield AsyncFunc(async_performer(intent)))
     except BackendConnectionError:
         if self.connection:
             yield AsyncFunc(self.connection.close_connection())
             self.connection = None
         raise
Пример #2
0
 def performer_with_connection(intent):
     if not self.connection:
         url = yield Effect(EBackendBlockStoreGetURL())
         self.connection = block_connection_factory(url)
     return (yield AsyncFunc(async_performer(intent)))
Пример #3
0
 def perform_user_vlob_update(self, intent):
     id = yield Effect(EGetAuthenticatedUser())
     yield AsyncFunc(self._perform_user_vlob_update(id, intent.version, intent.blob))
     yield Effect(EEvent('user_vlob_updated', id))
Пример #4
0
 def perform_user_vlob_read(self, intent):
     id = yield Effect(EGetAuthenticatedUser())
     return (yield AsyncFunc(self._perform_user_vlob_read(id, intent.version)))
Пример #5
0
 def perform_vlob_update(self, intent):
     yield AsyncFunc(self._perform_vlob_update(intent))
     yield Effect(EEvent('vlob_updated', intent.id))
Пример #6
0
 def perform_message_get(self, intent):
     id = yield Effect(EGetAuthenticatedUser())
     return (yield AsyncFunc(self._perform_message_get(id, intent)))
Пример #7
0
 def perform_message_new(self, intent):
     yield AsyncFunc(self._perform_message_new(intent))
     yield Effect(EEvent('message_arrived', intent.recipient))