From 61efd58cdb2348b9133fd497bc5f0133bf4f3cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Tikvi=C4=87?= Date: Mon, 5 Mar 2018 09:53:03 +0100 Subject: [PATCH] Put hotload enabling in separate function --- json_utility.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/json_utility.go b/json_utility.go index d94ac01..3ef16e3 100644 --- a/json_utility.go +++ b/json_utility.go @@ -69,7 +69,7 @@ type Payload struct { } // LoadPayloadsdetaData loads all payloads' information into 'metadata' variable. -func LoadPayloadsMetadata(db *ora.Ses, project string, hotloading bool, hlPeriod int) error { +func LoadPayloadsMetadata(db *ora.Ses, project string) error { metadataDB = db activeProject = project @@ -79,14 +79,17 @@ func LoadPayloadsMetadata(db *ora.Ses, project string, hotloading bool, hlPeriod if err != nil { return err } - if hotloading { - go hotload(hlPeriod) - } inited = true return nil } +func EnableHotloading(interval int) { + if interval > 0 { + go hotload(interval) + } +} + func GetMetadataForAllEntities() map[string]Payload { return metadata } -- 1.8.1.2