Skip to content

Commit

Permalink
Merge pull request #209 from tstromberg/gather-stats
Browse files Browse the repository at this point in the history
Add total conversations seen to loading page
  • Loading branch information
tstromberg authored Aug 25, 2020
2 parents 87a15f2 + 722e9f3 commit 2dafbc8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pkg/hubbub/hubbub.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ type Engine struct {
seen map[string]*Conversation
}

// ConversationsTotal returns the number of conversations we've seen so far
func (e *Engine) ConversationsTotal() int {
return len(e.seen)
}

func New(cfg Config) *Engine {
e := &Engine{
cache: cfg.Cache,
Expand Down
2 changes: 1 addition & 1 deletion pkg/site/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (h *Handlers) collectionPage(ctx context.Context, id string, refresh bool)
}

if result.RuleResults == nil {
p.Notification = `Gathering data ...`
p.Notification = template.HTML(fmt.Sprintf("Gathering data (%d issues examined) ...", h.party.ConversationsTotal()))
} else if p.ResultAge > h.warnAge {
p.Notification = template.HTML(fmt.Sprintf(`Refreshing data in the background. Displayed data may be up to %s old. Use <a href="https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Bypassing_cache">Shift-Reload</a> to force a data refresh at any time.`, humanDuration(time.Since(result.OldestInput))))
p.Stale = true
Expand Down
5 changes: 5 additions & 0 deletions pkg/triage/triage.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,8 @@ func processRules(raw map[string]Rule) (map[string]Rule, error) {

return rules, nil
}

// ConversationsTotal returns the number of conversations we've seen so far
func (p *Party) ConversationsTotal() int {
return p.engine.ConversationsTotal()
}
2 changes: 1 addition & 1 deletion site/collection.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
}
</script>
{{ else }}
<script>setTimeout(location.reload.bind(location), 1500);</script>
<script>setTimeout(location.reload.bind(location), 1000);</script>
{{ end }}

{{ end }}
2 changes: 1 addition & 1 deletion site/kanban.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
}
</script>
{{ else }}
<script>setTimeout(location.reload.bind(location), 1500);</script>
<script>setTimeout(location.reload.bind(location), 1000);</script>
{{ end }}

{{ end }}

0 comments on commit 2dafbc8

Please sign in to comment.