-better log entries; lower update frequency

This commit is contained in:
Gitea 2023-12-27 15:45:39 +00:00
parent 1e35a349c9
commit a26424b2b2
2 changed files with 5 additions and 6 deletions

View File

@ -107,7 +107,6 @@ func (d *Data) getProject() {
// filter out obsolete versions // filter out obsolete versions
project = p.Projects[0] project = p.Projects[0]
var versions Versions var versions Versions
log.Println("found", len(project.Versions), "versions")
for _, v := range project.Versions { for _, v := range project.Versions {
v := v v := v
if !v.Obsolete && !v.Released { if !v.Obsolete && !v.Released {
@ -127,7 +126,7 @@ func (d *Data) getProject() {
d.Timestamp = time.Now() d.Timestamp = time.Now()
d.Project = project d.Project = project
fmt.Println("Got project details for", d.projectId, "with", len(d.Project.Versions), "version entries") log.Println("Got project details for id", d.projectId, "with", len(d.Project.Versions), "version entries")
} }
const statusFilter = `status%5B%5D=10&status%5B%5D=20&status%5B%5D=30&status%5B%5D=40&status%5B%5D=50&severity%5B%5D=20` const statusFilter = `status%5B%5D=10&status%5B%5D=20&status%5B%5D=30&status%5B%5D=40&status%5B%5D=50&severity%5B%5D=20`
@ -203,7 +202,7 @@ func (d *Data) getIssues() {
} }
d.Issues = issues d.Issues = issues
d.Features = features d.Features = features
fmt.Println("Got", len(iss.Issues), "entries, of which", open, "are open and relevant:", len(features), "features and", len(issues), "issues") log.Println("Got", len(iss.Issues), "entries, of which", open, "are open and relevant:", len(features), "features and", len(issues), "issues")
} }
func (d *Data) Loop() { func (d *Data) Loop() {
@ -216,7 +215,7 @@ func (d *Data) Loop() {
case <-d.ctx.Done(): case <-d.ctx.Done():
return return
default: default:
fmt.Println("updating data") log.Println("Updating data")
d.getProject() d.getProject()
d.getIssues() d.getIssues()
} }

View File

@ -35,8 +35,8 @@ var (
fl_token = flag.String("token", os.Getenv("MANTIS_API_TOKEN"), "API-Token") fl_token = flag.String("token", os.Getenv("MANTIS_API_TOKEN"), "API-Token")
fl_port = flag.String("port", ":8080", "[ip]:port to serve") fl_port = flag.String("port", ":8080", "[ip]:port to serve")
fl_num = flag.Int("num", 250, "number of issues to retrieve at once") fl_num = flag.Int("num", 250, "number of issues to retrieve at once")
fl_min = flag.String("min", "0.9.3", "minimum version we care for") fl_min = flag.String("min", "0.9.1", "minimum version we care for")
fl_freq = flag.Duration("fr", time.Minute, "update frequency") fl_freq = flag.Duration("fr", 30*time.Minute, "update frequency")
fl_proj = flag.Int("project", 23, "project id to use") fl_proj = flag.Int("project", 23, "project id to use")
) )