Skip to content
Snippets Groups Projects
Commit 0c838f9f authored by Kegan Dougal's avatar Kegan Dougal
Browse files

Minor tweaks

parent 773cb3b6
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,7 @@ UP & quit +---------- YES SUCCESS ...@@ -49,6 +49,7 @@ UP & quit +---------- YES SUCCESS
| | | | | |
NO <--- Have more txns? <------ Mark txn success & nuke -+ NO <--- Have more txns? <------ Mark txn success & nuke -+
from db; incr AS pos. from db; incr AS pos.
Reset backoff.
This is all tied together by the AppServiceScheduler which DIs the required This is all tied together by the AppServiceScheduler which DIs the required
components. components.
...@@ -77,7 +78,7 @@ class AppServiceScheduler(object): ...@@ -77,7 +78,7 @@ class AppServiceScheduler(object):
def store_event(self, event): # event_pool def store_event(self, event): # event_pool
self.event_pool.append(event) self.event_pool.append(event)
def get_events(self): # event_pool def drain_events(self): # event_pool
return self.event_pool return self.event_pool
...@@ -90,11 +91,11 @@ class AppServiceTransaction(object): ...@@ -90,11 +91,11 @@ class AppServiceTransaction(object):
self.events = events self.events = events
def send(self, as_api): def send(self, as_api):
# sends this transaction using this as_api # TODO sends this transaction using this as_api
pass pass
def complete(self, store): def complete(self, store):
# increment txn id on AS and nuke txn contents from db # TODO increment txn id on AS and nuke txn contents from db
pass pass
...@@ -106,14 +107,14 @@ class _EventSorter(object): ...@@ -106,14 +107,14 @@ class _EventSorter(object):
self.services = services self.services = services
def start_polling(self): def start_polling(self):
events = self.event_pool.get_events() events = self.event_pool.drain_events()
if events: if events:
self._process(events) self._process(events)
# repoll later on # TODO repoll later on
def _process(self, events): def _process(self, events):
# sort events # TODO sort events
# f.e. (AS, events) => poke transaction controller # TODO fe (AS, events) => poke transaction controller on_receive_events
pass pass
...@@ -153,6 +154,7 @@ class _Recoverer(object): ...@@ -153,6 +154,7 @@ class _Recoverer(object):
if txn: if txn:
if txn.send(self.as_api): if txn.send(self.as_api):
txn.complete(self.store) txn.complete(self.store)
self.backoff_counter = 1
else: else:
self.backoff_counter += 1 self.backoff_counter += 1
self.recover(self.service) self.recover(self.service)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment