This commit is contained in:
Piotr Biernat 2024-07-19 22:46:43 +02:00
parent 6900ef5621
commit 5317cbe6e7
3 changed files with 1 additions and 37 deletions

1
src/.gitignore vendored
View File

@ -13,6 +13,5 @@
*.out
.env
# Dependency directories (remove the comment below to include it)
vendor/

View File

@ -1,35 +0,0 @@
package worker
// func WithRegistry(c *cnf.Config) OptionFn {
// return func(w *Worker) error {
// registry, err := consul.NewService(c.RegistryAddr, c.Base.AppID, c.Base.AppName, c.Base.AppID, "", "", 0)
// if err != nil {
// w.Logger.Log("Error connecting to %s: %v", c.RegistryAddr, err)
// }
// w.Registry = registry
// go func(w *Worker) { // Fetch Consul KV config and store it in app config
// ticker := time.NewTicker(time.Second * 15)
// for range ticker.C {
// fetchKVConfig(w) // FIXME: duplicated in server
// }
// }(w)
// return nil
// }
// }
// func fetchKVConfig(w *Worker) { // @FIXME: merge duplication in server.go and worker.go
// config, _, err := w.Registry.KV().Get(w.Config.KVNamespace, nil)
// if err != nil || config == nil {
// return
// }
// kvCnf := bytes.NewBuffer(config.Value)
// decoder := json.NewDecoder(kvCnf)
// if err := decoder.Decode(&w.Config); err != nil {
// return
// }
// }

View File

@ -125,7 +125,7 @@ func (w *Worker) doWork(while chan struct{}) error {
w.services["catalog"] =
service.NewCatalogService(w.GetDatabase(), w.GetEventBus(), w.GetLogger())
cSrv := (w.services["catalog"]).(*service.CatalogService) // FIXME simplify maybe...?
cSrv := (w.services["catalog"]).(*service.CatalogService)
msgs, err := w.GetEventBus().Consume(
w.cnf.EventBusQueue, // queue