Esempio n. 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
Esempio n. 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)))
Esempio n. 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))
Esempio n. 4
0
 def perform_user_vlob_read(self, intent):
     id = yield Effect(EGetAuthenticatedUser())
     return (yield AsyncFunc(self._perform_user_vlob_read(id, intent.version)))
Esempio n. 5
0
 def perform_vlob_update(self, intent):
     yield AsyncFunc(self._perform_vlob_update(intent))
     yield Effect(EEvent('vlob_updated', intent.id))
Esempio n. 6
0
 def perform_message_get(self, intent):
     id = yield Effect(EGetAuthenticatedUser())
     return (yield AsyncFunc(self._perform_message_get(id, intent)))
Esempio n. 7
0
 def perform_message_new(self, intent):
     yield AsyncFunc(self._perform_message_new(intent))
     yield Effect(EEvent('message_arrived', intent.recipient))