Queueing, prepping to fetch

A lot more to go, but this is the core.

Need to think about how to test the queue handlers.
This commit is contained in:
Matt Jadud
2025-11-30 21:29:30 -05:00
parent 06cdc68be7
commit f53639af2f
14 changed files with 258 additions and 105 deletions

9
internal/types/base.go Normal file
View File

@@ -0,0 +1,9 @@
package types
import (
"context"
"git.jadud.com/jadudm/grosbeak/internal/liteq"
)
type QueueWorker func(ctx context.Context, job *liteq.Job) error

View File

@@ -0,0 +1,9 @@
package types
type UpdateFrequency string
const (
UPDATE_DAILY UpdateFrequency = "DAILY"
UPDATE_WEEKLY UpdateFrequency = "WEEKLY"
UPDATE_MONTHLY UpdateFrequency = "MONTHLY"
)

22
internal/types/jobs.go Normal file
View File

@@ -0,0 +1,22 @@
package types
import "encoding/json"
type Job interface {
AsJson() string
}
// Used by all of the jobs.
func _as_json(j Job) string {
as_json, _ := json.Marshal(j)
return string(as_json)
}
type EntreJob struct {
URL string `json:"url"`
UpdateFrequency UpdateFrequency `json:"update_frequency"`
}
func (ej *EntreJob) AsJson() string {
return _as_json(ej)
}