From 71f683232fc88d7b676522baf835b5decb525a12 Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas@jonasled.de>
Date: Sun, 26 Jan 2025 17:14:16 +0100
Subject: [PATCH] run message worker for local queue

---
 main.go                 | 1 +
 messageworker/client.go | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go
index bde7bd2..fa13f6a 100644
--- a/main.go
+++ b/main.go
@@ -37,6 +37,7 @@ func main() {
 	}
 	if os.Getenv("LOGGER_SERVER") == "true" {
 		server.Init()
+		go messageworker.RunServer()
 		server.Run()
 	} else {
 		log.Log.Fatal("Either LOGGER_CLIENT or LOGGER_SERVER has to be enabled in config")
diff --git a/messageworker/client.go b/messageworker/client.go
index 8ebe615..17b1c85 100644
--- a/messageworker/client.go
+++ b/messageworker/client.go
@@ -17,11 +17,15 @@ func RunClient() {
 	if os.Getenv("CLIENT_USE_SERVER") != "true" {
 
 		log.Log.Info("Intialized local client with direct datbase connection")
-		runLocalDbClient()
+		runDbClient()
 	}
 }
 
-func runLocalDbClient() {
+func RunServer() {
+	runDbClient()
+}
+
+func runDbClient() {
 	for {
 		taskData, taskId, err := queue.MainQueue.Dequeue()
 		if err != nil {
-- 
GitLab