GODT-1468: Fix main windows status and add background context without retry.

This commit is contained in:
Jakub
2021-12-13 12:29:49 +01:00
parent 3bb9146d9f
commit d40fbda2ab
12 changed files with 101 additions and 112 deletions

View File

@ -81,7 +81,7 @@ func (loop *eventLoop) client() pmapi.Client {
func (loop *eventLoop) setFirstEventID() (err error) {
loop.log.Info("Setting first event ID")
event, err := loop.client().GetEvent(context.Background(), "")
event, err := loop.client().GetEvent(pmapi.ContextWithoutRetry(context.Background()), "")
if err != nil {
loop.log.WithError(err).Error("Could not get latest event ID")
return
@ -269,7 +269,7 @@ func (loop *eventLoop) processNextEvent() (more bool, err error) { // nolint[fun
loop.pollCounter++
var event *pmapi.Event
if event, err = loop.client().GetEvent(context.Background(), loop.currentEventID); err != nil {
if event, err = loop.client().GetEvent(pmapi.ContextWithoutRetry(context.Background()), loop.currentEventID); err != nil {
return false, errors.Wrap(err, "failed to get event")
}

View File

@ -312,7 +312,7 @@ func (store *Store) client() pmapi.Client {
// initCounts initialises the counts for each label. It tries to use the API first to fetch the labels but if
// the API is unavailable for whatever reason it tries to fetch the labels locally.
func (store *Store) initCounts() (labels []*pmapi.Label, err error) {
if labels, err = store.client().ListLabels(context.Background()); err != nil {
if labels, err = store.client().ListLabels(pmapi.ContextWithoutRetry(context.Background())); err != nil {
store.log.WithError(err).Warn("Could not list API labels. Trying with local labels.")
if labels, err = store.getLabelsFromLocalStorage(); err != nil {
store.log.WithError(err).Error("Cannot list local labels")