changeset 1551:d9eba69f6515

Registered a dummy callback function for scheduled fairway imports in the scheduler.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 10 Dec 2018 18:14:44 +0100
parents fe633765e05b
children 35f85da41fdb
files pkg/imports/fwsched.go pkg/scheduler/scheduler.go
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pkg/imports/fwsched.go	Mon Dec 10 18:14:44 2018 +0100
@@ -0,0 +1,29 @@
+// This is Free Software under GNU Affero General Public License v >= 3.0
+// without warranty, see README.md and license for details.
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// License-Filename: LICENSES/AGPL-3.0.txt
+//
+// Copyright (C) 2018 by via donau
+//   – Österreichische Wasserstraßen-Gesellschaft mbH
+// Software engineering by Intevation GmbH
+//
+// Author(s):
+//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+package imports
+
+import (
+	"log"
+
+	"gemma.intevation.de/gemma/pkg/scheduler"
+)
+
+func init() {
+	scheduler.RegisterAction("fw", scheduledFW)
+}
+
+func scheduledFW(user string, cfgID *int64) {
+	log.Println("info: scheduled FW import")
+	// TODO: Implement me!
+}
--- a/pkg/scheduler/scheduler.go	Mon Dec 10 17:46:42 2018 +0100
+++ b/pkg/scheduler/scheduler.go	Mon Dec 10 18:14:44 2018 +0100
@@ -15,6 +15,7 @@
 
 import (
 	"errors"
+	"log"
 	"sync"
 
 	"github.com/robfig/cron"
@@ -218,6 +219,7 @@
 }
 
 func (s *scheduler) registerAction(name string, action Action) {
+	log.Printf("info: register action '%s' in scheduler.", name)
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	s.actions[name] = action