mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Bug fixes whilst putting it all together
This commit is contained in:
parent
b98cd03193
commit
04c9751f24
@ -79,6 +79,7 @@ class ApplicationServiceApi(SimpleHttpClient):
|
|||||||
logger.warning("push_bulk: Missing txn ID sending events to %s",
|
logger.warning("push_bulk: Missing txn ID sending events to %s",
|
||||||
service.url)
|
service.url)
|
||||||
txn_id = str(0)
|
txn_id = str(0)
|
||||||
|
txn_id = str(txn_id)
|
||||||
|
|
||||||
uri = service.url + ("/transactions/%s" %
|
uri = service.url + ("/transactions/%s" %
|
||||||
urllib.quote(txn_id))
|
urllib.quote(txn_id))
|
||||||
|
@ -175,7 +175,7 @@ class _TransactionController(object):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _is_service_up(self, service):
|
def _is_service_up(self, service):
|
||||||
state = yield self.store.get_appservice_state(service)
|
state = yield self.store.get_appservice_state(service)
|
||||||
defer.returnValue(state == ApplicationServiceState.UP)
|
defer.returnValue(state == ApplicationServiceState.UP or state is None)
|
||||||
|
|
||||||
|
|
||||||
class _Recoverer(object):
|
class _Recoverer(object):
|
||||||
@ -208,6 +208,8 @@ class _Recoverer(object):
|
|||||||
def retry(self):
|
def retry(self):
|
||||||
txn = yield self._get_oldest_txn()
|
txn = yield self._get_oldest_txn()
|
||||||
if txn:
|
if txn:
|
||||||
|
logger.info("Retrying transaction %s for service %s",
|
||||||
|
txn.id, txn.service)
|
||||||
if txn.send(self.as_api):
|
if txn.send(self.as_api):
|
||||||
txn.complete(self.store)
|
txn.complete(self.store)
|
||||||
# reset the backoff counter and retry immediately
|
# reset the backoff counter and retry immediately
|
||||||
|
@ -337,9 +337,8 @@ class ApplicationServiceStore(SQLBaseStore):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _populate_cache(self):
|
def _populate_cache(self):
|
||||||
"""Populates the ApplicationServiceCache from the database."""
|
"""Populates the ApplicationServiceCache from the database."""
|
||||||
sql = ("SELECT * FROM application_services LEFT JOIN "
|
sql = ("SELECT r.*, a.* FROM application_services AS a LEFT JOIN "
|
||||||
"application_services_regex ON application_services.id = "
|
"application_services_regex AS r ON a.id = r.as_id")
|
||||||
"application_services_regex.as_id")
|
|
||||||
|
|
||||||
results = yield self._execute_and_decode(sql)
|
results = yield self._execute_and_decode(sql)
|
||||||
services = self._parse_services_dict(results)
|
services = self._parse_services_dict(results)
|
||||||
@ -528,7 +527,7 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
event_ids = json.loads(entry["event_ids"])
|
event_ids = json.loads(entry["event_ids"])
|
||||||
events = self._get_events_txn(event_ids)
|
events = self._get_events_txn(txn, event_ids)
|
||||||
|
|
||||||
return AppServiceTransaction(
|
return AppServiceTransaction(
|
||||||
service=service, id=entry["txn_id"], events=events
|
service=service, id=entry["txn_id"], events=events
|
||||||
@ -540,7 +539,7 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
|
|||||||
(service_id,)
|
(service_id,)
|
||||||
)
|
)
|
||||||
last_txn_id = result.fetchone()
|
last_txn_id = result.fetchone()
|
||||||
if last_txn_id is None: # no row exists
|
if last_txn_id is None or last_txn_id[0] is None: # no row exists
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
return int(last_txn_id[0]) # select 'last_txn' col
|
return int(last_txn_id[0]) # select 'last_txn' col
|
||||||
|
Loading…
Reference in New Issue
Block a user