feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
34
internal/notifyrender/count.go
Обычный файл
34
internal/notifyrender/count.go
Обычный файл
@@ -0,0 +1,34 @@
|
||||
// Package notifyrender owns the subject/body templates used by both the
|
||||
// legacy sender (internal/sender) and the worker-driven notification
|
||||
// producer (internal/notifier). It is a leaf package so the notifier package
|
||||
// can pre-render notification content for the worker without importing the
|
||||
// sender package, which would otherwise create an import cycle (sender's
|
||||
// tests already import notifier to drive the legacy loop).
|
||||
package notifyrender
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"rsgit.ru/rsmon/rsmon/config/translator"
|
||||
)
|
||||
|
||||
// GetCount provides functionality.
|
||||
func GetCount(count int, kind string) string {
|
||||
tr, err := translator.Translator.C(kind, float64(count), 0, strconv.Itoa(count))
|
||||
if err != nil {
|
||||
log.Println("translator error", err)
|
||||
return "монитор"
|
||||
}
|
||||
return tr
|
||||
}
|
||||
|
||||
// GetDownMany provides functionality.
|
||||
func GetDownMany(count int) string {
|
||||
return "Не " + GetCount(count, "monitor")
|
||||
}
|
||||
|
||||
// GetUpMany provides functionality.
|
||||
func GetUpMany(count int) string {
|
||||
return "Снова " + GetCount(count, "monitor")
|
||||
}
|
||||
Ссылка в новой задаче
Block a user