fix(inferium-server): do not consider new harvester if a computer id is given
This commit is contained in:
parent
a28ccbc920
commit
dd79ecb941
@ -3,7 +3,7 @@ local utils = require('libs/utils')
|
|||||||
local inferium = require('config/inferium')
|
local inferium = require('config/inferium')
|
||||||
|
|
||||||
local DEFAULT_HARVESTER_NAME = 'harvester'
|
local DEFAULT_HARVESTER_NAME = 'harvester'
|
||||||
local VERSION = "2.0.0"
|
local VERSION = "2.0.1"
|
||||||
local INFERIUM_SERVER = 'inferium.com'
|
local INFERIUM_SERVER = 'inferium.com'
|
||||||
|
|
||||||
local PERSISTED_CONFIGS = '/data/inferium-configs'
|
local PERSISTED_CONFIGS = '/data/inferium-configs'
|
||||||
@ -76,15 +76,18 @@ end
|
|||||||
|
|
||||||
-- Routes
|
-- Routes
|
||||||
|
|
||||||
local function getConfig(_, computerId)
|
local function getConfig(message, computerId)
|
||||||
if not computerId == nil then
|
if not computerId == nil then
|
||||||
print('get-config error: no computerId found')
|
print('get-config error: no computerId found')
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local config = getConfigForComputer(computerId)
|
local givenHarvesterId = message and message.payload and message.payload.id
|
||||||
|
|
||||||
if not config then
|
local id = givenHarvesterId or computerId
|
||||||
|
local config = getConfigForComputer(id)
|
||||||
|
|
||||||
|
if not givenHarvesterId and not config then
|
||||||
print('new harvester detected: ' .. tostring(computerId))
|
print('new harvester detected: ' .. tostring(computerId))
|
||||||
saveConfigForComputer(computerId, defaultConfig)
|
saveConfigForComputer(computerId, defaultConfig)
|
||||||
config = defaultConfig
|
config = defaultConfig
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user