| @@ -3,7 +3,6 @@ package bridge | |||||
| import ( | import ( | ||||
| "context" | "context" | ||||
| "encoding/json" | "encoding/json" | ||||
| "fmt" | |||||
| "log/slog" | "log/slog" | ||||
| "sync" | "sync" | ||||
| "time" | "time" | ||||
| @@ -97,7 +96,6 @@ func (a *BridgeApp) Run(ctx context.Context) { | |||||
| case msg := <-a.ChApi: | case msg := <-a.ChApi: | ||||
| switch msg.Method { | switch msg.Method { | ||||
| case "POST": | case "POST": | ||||
| fmt.Println("adding beacon to lookup", "mac", msg.MAC, "id", msg.ID) | |||||
| a.AppState.AddBeaconToLookup(msg.MAC, msg.ID) | a.AppState.AddBeaconToLookup(msg.MAC, msg.ID) | ||||
| slog.Info("beacon added to lookup", "id", msg.ID) | slog.Info("beacon added to lookup", "id", msg.ID) | ||||
| case "DELETE": | case "DELETE": | ||||
| @@ -3,7 +3,6 @@ package apiclient | |||||
| import ( | import ( | ||||
| "encoding/json" | "encoding/json" | ||||
| "fmt" | "fmt" | ||||
| "io" | |||||
| "net/http" | "net/http" | ||||
| "github.com/AFASystems/presence/internal/pkg/config" | "github.com/AFASystems/presence/internal/pkg/config" | ||||
| @@ -17,13 +16,6 @@ func GetTrackers(token string, client *http.Client, cfg *config.Config) ([]model | |||||
| return []model.Tracker{}, err | return []model.Tracker{}, err | ||||
| } | } | ||||
| bodyBytes, err := io.ReadAll(res.Body) | |||||
| if err != nil { | |||||
| fmt.Printf("error read body: %+v\n", err) | |||||
| return []model.Tracker{}, err | |||||
| } | |||||
| fmt.Printf("body: %s\n", string(bodyBytes)) | |||||
| var i []model.Tracker | var i []model.Tracker | ||||
| err = json.NewDecoder(res.Body).Decode(&i) | err = json.NewDecoder(res.Body).Decode(&i) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -29,7 +29,6 @@ func UpdateDB(db *gorm.DB, ctx context.Context, cfg *config.Config, writer *kafk | |||||
| } | } | ||||
| if trackers, err := GetTrackers(token, client, cfg); err == nil { | if trackers, err := GetTrackers(token, client, cfg); err == nil { | ||||
| fmt.Printf("trackers: %+v\n", trackers) | |||||
| syncTable(db, trackers) | syncTable(db, trackers) | ||||
| if err := controller.SendKafkaMessage(writer, &model.ApiUpdate{Method: "DELETE", MAC: "all"}, ctx); err != nil { | if err := controller.SendKafkaMessage(writer, &model.ApiUpdate{Method: "DELETE", MAC: "all"}, ctx); err != nil { | ||||
| msg := fmt.Sprintf("Error in sending delete all from lookup message: %v", err) | msg := fmt.Sprintf("Error in sending delete all from lookup message: %v", err) | ||||
| @@ -3,7 +3,6 @@ package bridge | |||||
| import ( | import ( | ||||
| "context" | "context" | ||||
| "encoding/json" | "encoding/json" | ||||
| "fmt" | |||||
| "log/slog" | "log/slog" | ||||
| "strings" | "strings" | ||||
| "time" | "time" | ||||
| @@ -39,7 +38,6 @@ func HandleMQTTMessage(topic string, payload []byte, appState *appcontext.AppSta | |||||
| if !ok { | if !ok { | ||||
| continue | continue | ||||
| } | } | ||||
| fmt.Println("beacon found: ", id) | |||||
| adv := appcontext.BeaconAdvertisement{ | adv := appcontext.BeaconAdvertisement{ | ||||
| ID: id, | ID: id, | ||||
| Hostname: hostname, | Hostname: hostname, | ||||