fix
This commit is contained in:
parent
b7fbcbc089
commit
5b86b919f6
|
|
@ -64,19 +64,23 @@ async def license_index_loop(memory, platform_found: bool, seqno: int) -> [bool,
|
||||||
chat_wrap = Wrapped_CBotChat(CLIENT_TELEGRAM_API_KEY, chat_id=user.telegram_id, db_session=session, user=user)
|
chat_wrap = Wrapped_CBotChat(CLIENT_TELEGRAM_API_KEY, chat_id=user.telegram_id, db_session=session, user=user)
|
||||||
content = session.query(StoredContent).filter_by(id=action.content_id).first()
|
content = session.query(StoredContent).filter_by(id=action.content_id).first()
|
||||||
|
|
||||||
|
edited_ = False
|
||||||
if (datetime.now() - action.created) > timedelta(minutes=5):
|
if (datetime.now() - action.created) > timedelta(minutes=5):
|
||||||
if action.telegram_message_id:
|
if action.telegram_message_id:
|
||||||
await chat_wrap.delete_message(action.telegram_message_id)
|
await chat_wrap.delete_message(action.telegram_message_id)
|
||||||
|
|
||||||
make_log("LicenseIndex", f"Action timeout: {action.id}", level="info")
|
make_log("LicenseIndex", f"Action timeout: {action.id}", level="info")
|
||||||
action.status = 'canceled'
|
action.status = 'canceled'
|
||||||
|
edited_ = True
|
||||||
else:
|
else:
|
||||||
user_wallet_address = user.wallet_address(session)
|
user_wallet_address = user.wallet_address(session)
|
||||||
user_content = session.query(UserContent).filter_by(content_id=action.content_id, status='active', owner_address=user_wallet_address).first()
|
user_content = session.query(UserContent).filter_by(content_id=action.content_id, status='active', owner_address=user_wallet_address).first()
|
||||||
if user_content:
|
if user_content:
|
||||||
make_log("LicenseIndex", f"User already has content: {user_content.content_id}", level="info")
|
make_log("LicenseIndex", f"User already has content: {user_content.content_id}", level="info")
|
||||||
action.status = 'success'
|
action.status = 'success'
|
||||||
|
edited_ = True
|
||||||
|
|
||||||
|
if edited_:
|
||||||
session.commit()
|
session.commit()
|
||||||
await chat_wrap.send_content(session, content)
|
await chat_wrap.send_content(session, content)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue