1
0
mirror of https://github.com/thingsboard/thingsboard-gateway synced 2025-10-26 22:31:42 +08:00

Auto update improvements

This commit is contained in:
zbeacon
2020-05-15 19:04:28 +03:00
parent af5d3fbaa9
commit 88820a03c9
2 changed files with 6 additions and 7 deletions

View File

@@ -63,7 +63,7 @@ class TBGatewayService:
global log
log = logging.getLogger('service')
log.info("Gateway starting...")
self.__updater = TBUpdater(config)
self.__updater = TBUpdater()
self.__updates_check_period_ms = 3000
self.__updates_check_time = 0
self.version = self.__updater.get_version()

View File

@@ -21,15 +21,14 @@ from threading import Thread
from time import time, sleep
from simplejson import loads
from thingsboard_gateway.tb_utility.tb_utility import TBUtility
log = getLogger("service")
UPDATE_SERVICE_BASE_URL = "https://updates.thingsboard.io"
# UPDATE_SERVICE_BASE_URL = "https://updates.thingsboard.io"
UPDATE_SERVICE_BASE_URL = "http://127.0.0.1:8090"
class TBUpdater(Thread):
def __init__(self, auto_updates_enabled):
def __init__(self):
super().__init__()
self.__version = {"current_version": get_distribution('thingsboard_gateway').version,
"latest_version": None}
@@ -76,7 +75,7 @@ class TBUpdater(Thread):
def form_request_params(self):
json_data = {
"version": self.__version,
"version": self.__version["current_version"],
"platform": self.__platform,
"instanceId": self.__instance_id,
"osVersion": self.__os_version,
@@ -92,4 +91,4 @@ class TBUpdater(Thread):
if __name__ == '__main__':
updater = TBUpdater("test", True)
updater = TBUpdater()