From a28fa4d7f261861f4fe6c7e44491cde600469f60 Mon Sep 17 00:00:00 2001 From: radex Date: Mon, 9 Oct 2023 00:07:04 +0200 Subject: [PATCH] hswaw/site: remove mirko dependency Change-Id: Id64cccadcd1e109035ed09f62086772fa615dd72 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1690 Reviewed-by: q3k Reviewed-by: radex --- hswaw/site/BUILD.bazel | 1 - hswaw/site/README.md | 2 +- hswaw/site/main.go | 18 ++++++------------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/hswaw/site/BUILD.bazel b/hswaw/site/BUILD.bazel index 5f55a004..aa75ee7d 100644 --- a/hswaw/site/BUILD.bazel +++ b/hswaw/site/BUILD.bazel @@ -14,7 +14,6 @@ go_library( importpath = "code.hackerspace.pl/hscloud/hswaw/site", visibility = ["//visibility:private"], deps = [ - "//go/mirko", "//hswaw/site/calendar", "//hswaw/site/static:static_go", "//hswaw/site/templates:templates_go", diff --git a/hswaw/site/README.md b/hswaw/site/README.md index 2d359746..7a992dc5 100644 --- a/hswaw/site/README.md +++ b/hswaw/site/README.md @@ -11,7 +11,7 @@ It replaces the old [www-main](https://code.hackerspace.pl/q3k/www-main) app. Running locally --- - $ bazel run //hswaw/site -- -hspki_disable + $ bazel run //hswaw/site And point your web browser to 127.0.0.1:8080. diff --git a/hswaw/site/main.go b/hswaw/site/main.go index ff01b2d8..7def3c85 100644 --- a/hswaw/site/main.go +++ b/hswaw/site/main.go @@ -1,6 +1,7 @@ package main import ( + "context" "flag" "fmt" "math/rand" @@ -11,7 +12,6 @@ import ( "sync" "time" - "code.hackerspace.pl/hscloud/go/mirko" "github.com/golang/glog" "code.hackerspace.pl/hscloud/hswaw/site/calendar" @@ -42,14 +42,12 @@ func main() { rand.Seed(time.Now().UnixNano()) - mi := mirko.New() - if err := mi.Listen(); err != nil { - glog.Exitf("Listen failed: %v", err) - } + // TODO(q3k): use sigint-interruptible context + ctx := context.Background() s := &service{} - go s.feedWorker(mi.Context()) - go s.eventsWorker(mi.Context()) + go s.feedWorker(ctx) + go s.eventsWorker(ctx) mux := http.NewServeMux() s.registerHTTP(mux) @@ -61,11 +59,7 @@ func main() { } }() - if err := mi.Serve(); err != nil { - glog.Exitf("Serve failed: %v", err) - } - - <-mi.Done() + <-ctx.Done() } var (