Browse Source

inteval auto

qiaofeng1227 2 years ago
parent
commit
ba6957c84e
2 changed files with 5 additions and 2 deletions
  1. 1 1
      appmanage/Dockerfile
  2. 4 1
      appmanage/api/service/manage.py

+ 1 - 1
appmanage/Dockerfile

@@ -10,7 +10,7 @@ COPY static ./static
 COPY requirements.txt main.py  ./
 RUN apt update
 
-# Install supervisords
+# Install supervisord
 RUN apt install -y supervisor
 COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 COPY config/cmd.sh /cmd.sh

+ 4 - 1
appmanage/api/service/manage.py

@@ -22,7 +22,9 @@ from rq import Queue, Worker, Connection
 from rq.registry import StartedJobRegistry, FinishedJobRegistry, DeferredJobRegistry, FailedJobRegistry, ScheduledJobRegistry, CanceledJobRegistry
 from api.exception.command_exception import CommandException
 from apscheduler.schedulers.background import BackgroundScheduler
+from apscheduler.triggers.date import DateTrigger
 from apscheduler.triggers.cron import CronTrigger
+from apscheduler.triggers.interval import IntervalTrigger
 
 
 # 指定 Redis 容器的主机名和端口
@@ -35,7 +37,8 @@ def auto_update():
     shell_execute.execute_command_output_all("wget https://websoft9.github.io/StackHub/install/update_appstore.sh && bash update_appstore.sh 1>/dev/null 2>&1")
 
 scheduler = BackgroundScheduler()
-scheduler.add_job(auto_update, CronTrigger(hour=1, minute=0))
+#scheduler.add_job(auto_update, CronTrigger(hour=1, minute=0))
+scheduler.add_job(auto_update, IntervalTrigger(minutes=1))
 scheduler.shutdown()
 
 # 获取github文件内容