fix transaction id
This commit is contained in:
parent
ffc4af4b9b
commit
4037a8a68b
1 changed files with 5 additions and 4 deletions
|
@ -13,12 +13,11 @@ _shutdown = threading.Event()
|
|||
|
||||
class ChannelMonitor(threading.Thread):
|
||||
|
||||
txId = 0
|
||||
|
||||
def __init__(self):
|
||||
threading.Thread.__init__(self)
|
||||
self.matrix_api_url = app.config['MATRIX_HOST'] + '/_matrix/client/r0'
|
||||
self.matrix_api_token = app.config['MATRIX_AS_TOKEN']
|
||||
self.txId = 0
|
||||
|
||||
def generate_matrix_id(self, username):
|
||||
m_username = app.config['MATRIX_PNUT_PREFIX'] + username
|
||||
|
@ -73,7 +72,7 @@ class ChannelMonitor(threading.Thread):
|
|||
r = requests.post(url, params=params)
|
||||
|
||||
def send_message(self, roomid, msg):
|
||||
url = self.matrix_api_url + '/rooms/' + roomid +'/send/m.room.message' + '/' + str(txId)
|
||||
url = self.matrix_api_url + '/rooms/' + roomid +'/send/m.room.message' + '/' + str(self.txId)
|
||||
params = {
|
||||
'access_token': self.matrix_api_token,
|
||||
'user_id': msg['user']['user_id'],
|
||||
|
@ -139,7 +138,7 @@ class ChannelMonitor(threading.Thread):
|
|||
db.session.commit()
|
||||
|
||||
for item in pqueue:
|
||||
txId += 1
|
||||
self.txId += 1
|
||||
|
||||
d = self.is_registered(item['user']['user_id'])
|
||||
if not d:
|
||||
|
@ -157,6 +156,8 @@ class ChannelMonitor(threading.Thread):
|
|||
def run(self):
|
||||
logging.info("-- Starting channel monitor --")
|
||||
app.app_context().push()
|
||||
rooms = MatrixRoom.query.all()
|
||||
self.txId = int(rooms[0].pnut_since)
|
||||
while not _shutdown.isSet():
|
||||
rooms = MatrixRoom.query.all()
|
||||
for r in rooms:
|
||||
|
|
Loading…
Reference in a new issue