refactor: move models to their own package to use the same as in the importer
This commit is contained in:
parent
553a85562b
commit
9aa1b7384d
14 changed files with 170 additions and 152 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue