dever 4 years ago
parent
commit
7d705c18f0
3 changed files with 11 additions and 4 deletions
  1. 5 2
      cron.py
  2. 5 1
      service/cron/mqtt_sub.py
  3. 1 1
      service/cron/timing.py

+ 5 - 2
cron.py

@@ -15,5 +15,8 @@ Demeter.echo(Demeter.option['method'])
 method = Demeter.option['method']
 
 cron = Demeter.service(method, 'cron')
-while(True):
-	cron.handle()
+if 'mqtt_' in method:
+	cron.run()
+else:
+	while(True):
+		cron.run()

+ 5 - 1
service/cron/mqtt_sub.py

@@ -4,10 +4,14 @@
     name:sub.py
     author:rabin
 """
+import time
+from demeter.core import *
 from demeter.mqtt import *
+timeSleep = 1000
 import random
 class Mqtt_sub(object):
-	Sub()
+	def run(self):
+		Sub()
 
 """
 data = {}

+ 1 - 1
service/cron/timing.py

@@ -6,7 +6,7 @@
 """
 import time
 from demeter.core import *
-timeSleep = 10
+timeSleep = 60
 
 # 设置过期时间
 class Timing(object):