refactor: move models to their own package to use the same as in the importer

This commit is contained in:
Patryk Hegenberg 2025-09-24 22:57:37 +02:00
parent 553a85562b
commit 9aa1b7384d
14 changed files with 170 additions and 152 deletions

View file

@ -4,6 +4,7 @@ import (
"context"
"log/slog"
"time"
"tixel_watch/models"
)
type LogProcessor struct {
@ -18,8 +19,8 @@ func NewLogProcessor(storage StorageInterface) *LogProcessor {
}
}
func (lp *LogProcessor) Start(ctx context.Context, logChan <-chan LogEntry) {
batch := make([]LogEntry, 0, lp.batchSize)
func (lp *LogProcessor) Start(ctx context.Context, logChan <-chan models.LogMessage) {
batch := make([]models.LogMessage, 0, lp.batchSize)
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
@ -58,7 +59,7 @@ func (lp *LogProcessor) Start(ctx context.Context, logChan <-chan LogEntry) {
}
}
func (lp *LogProcessor) storeBatch(ctx context.Context, batch []LogEntry) {
func (lp *LogProcessor) storeBatch(ctx context.Context, batch []models.LogMessage) {
if len(batch) == 0 {
return
}