AI Update: یک مشکل بزرگ وجود دارد در این پروژه فقط یک نفر میتواند همزما
This commit is contained in:
@@ -347,8 +347,10 @@ class SessionManager:
|
|||||||
"last_context_length": curr.last_context_length if curr else None,
|
"last_context_length": curr.last_context_length if curr else None,
|
||||||
"last_total_tokens": curr.last_total_tokens if curr else None,
|
"last_total_tokens": curr.last_total_tokens if curr else None,
|
||||||
}
|
}
|
||||||
with open(self.storage_file, "w", encoding="utf-8") as f:
|
tmp_file = f"{self.storage_file}.tmp.{os.getpid()}_{int(time.time()*1000)}"
|
||||||
|
with open(tmp_file, "w", encoding="utf-8") as f:
|
||||||
json.dump(data, f, indent=2)
|
json.dump(data, f, indent=2)
|
||||||
|
os.replace(tmp_file, self.storage_file)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error saving sessions: {e}")
|
logger.error(f"Error saving sessions: {e}")
|
||||||
|
|
||||||
|
|||||||
@@ -5910,10 +5910,11 @@ def main():
|
|||||||
logger.error("TELEGRAM_BOT_TOKEN is not set!")
|
logger.error("TELEGRAM_BOT_TOKEN is not set!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
logger.info("Initializing Telegram Bot Application...")
|
logger.info("Initializing Telegram Bot Application with concurrent_updates enabled...")
|
||||||
application = (
|
application = (
|
||||||
Application.builder()
|
Application.builder()
|
||||||
.token(settings.telegram_bot_token)
|
.token(settings.telegram_bot_token)
|
||||||
|
.concurrent_updates(True)
|
||||||
.post_init(on_startup)
|
.post_init(on_startup)
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user