mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 19:37:34 +08:00
update dependencies, enhance dump backup
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
requests==2.28.1
|
requests==2.28.1
|
||||||
pytelegrambotapi==4.7.1
|
pytelegrambotapi==4.8.0
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.11.1
|
||||||
tgbot-ping==1.0.4
|
tgbot-ping==1.0.4
|
||||||
redis==4.3.4
|
redis==4.4.0
|
||||||
apscheduler==3.9.1.post1
|
apscheduler==3.9.1.post1
|
||||||
pymongo==4.3.3
|
pymongo==4.3.3
|
||||||
tornado==6.2
|
tornado==6.2
|
||||||
captcha==0.4
|
captcha==0.4
|
||||||
passlib==1.7.4
|
passlib==1.7.4
|
||||||
fakeredis==2.1.0
|
fakeredis==2.4.0
|
||||||
pytz==2022.6
|
pytz==2022.7
|
||||||
filetype==1.2.0
|
filetype==1.2.0
|
||||||
requests[socks]
|
requests[socks]
|
||||||
tqdm==4.64.1
|
tqdm==4.64.1
|
||||||
|
|||||||
@@ -220,13 +220,18 @@ def zip_file():
|
|||||||
|
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
|
# this function will never occur any errors!
|
||||||
logging.info("Cleaning up...")
|
logging.info("Cleaning up...")
|
||||||
con = MySQL()
|
with contextlib.suppress(Exception):
|
||||||
con.cursor().execute("drop database zimuzu")
|
con = MySQL()
|
||||||
con.close()
|
con.cursor().execute("drop database zimuzu")
|
||||||
os.unlink(sqlite_file)
|
con.close()
|
||||||
MongoDB().drop_database("share")
|
with contextlib.suppress(Exception):
|
||||||
os.unlink("zimuzu.sql")
|
os.unlink(sqlite_file)
|
||||||
|
with contextlib.suppress(Exception):
|
||||||
|
MongoDB().drop_database("share")
|
||||||
|
with contextlib.suppress(Exception):
|
||||||
|
os.unlink("zimuzu.sql")
|
||||||
|
|
||||||
|
|
||||||
def entry_dump():
|
def entry_dump():
|
||||||
@@ -241,10 +246,5 @@ def entry_dump():
|
|||||||
logging.info("Total time used: %.2fs" % (time.time() - t0))
|
logging.info("Total time used: %.2fs" % (time.time() - t0))
|
||||||
|
|
||||||
|
|
||||||
def no_error_entry_dump():
|
|
||||||
with contextlib.suppress(Exception):
|
|
||||||
entry_dump()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
entry_dump()
|
entry_dump()
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import platform
|
import platform
|
||||||
import threading
|
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
import tornado.autoreload
|
import tornado.autoreload
|
||||||
@@ -21,6 +20,7 @@ from tornado import httpserver, ioloop, options, web
|
|||||||
from tornado.log import enable_pretty_logging
|
from tornado.log import enable_pretty_logging
|
||||||
|
|
||||||
import dump_db
|
import dump_db
|
||||||
|
from Mongo import OtherMongoResource, ResourceLatestMongoResource
|
||||||
from handler import (AnnouncementHandler, BlacklistHandler, CaptchaHandler,
|
from handler import (AnnouncementHandler, BlacklistHandler, CaptchaHandler,
|
||||||
CategoryHandler, CommentChildHandler, CommentHandler,
|
CategoryHandler, CommentChildHandler, CommentHandler,
|
||||||
CommentNewestHandler, CommentReactionHandler,
|
CommentNewestHandler, CommentReactionHandler,
|
||||||
@@ -32,7 +32,6 @@ from handler import (AnnouncementHandler, BlacklistHandler, CaptchaHandler,
|
|||||||
ResourceLatestHandler, SpamProcessHandler, TopHandler,
|
ResourceLatestHandler, SpamProcessHandler, TopHandler,
|
||||||
UserEmailHandler, UserHandler)
|
UserEmailHandler, UserHandler)
|
||||||
from migration.douban_sync import sync_douban
|
from migration.douban_sync import sync_douban
|
||||||
from Mongo import OtherMongoResource, ResourceLatestMongoResource
|
|
||||||
from utils import Cloudflare
|
from utils import Cloudflare
|
||||||
|
|
||||||
enable_pretty_logging()
|
enable_pretty_logging()
|
||||||
@@ -110,8 +109,6 @@ if __name__ == "__main__":
|
|||||||
scheduler.add_job(OtherMongoResource().import_ban_user, 'interval', seconds=300)
|
scheduler.add_job(OtherMongoResource().import_ban_user, 'interval', seconds=300)
|
||||||
scheduler.add_job(cf.clear_fw, trigger=CronTrigger.from_crontab("0 0 */5 * *"))
|
scheduler.add_job(cf.clear_fw, trigger=CronTrigger.from_crontab("0 0 */5 * *"))
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
logging.info("Triggering dump database now...")
|
|
||||||
threading.Thread(target=dump_db.no_error_entry_dump).start()
|
|
||||||
|
|
||||||
options.define("p", default=8888, help="running port", type=int)
|
options.define("p", default=8888, help="running port", type=int)
|
||||||
options.define("h", default='127.0.0.1', help="listen address", type=str)
|
options.define("h", default='127.0.0.1', help="listen address", type=str)
|
||||||
|
|||||||
Reference in New Issue
Block a user