Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

lookup timeout on feed content recovery #2210

@santicomp2014

Description

@santicomp2014

In #2202 the timeout for getFeedContent was removed.

There seems to be an issue with the context that is passed down to the feed operations.

If there is a context timeout (starting from the download) that expires before reaching getFeedContent, then the recovery process will fail.

The combination of timeouts (the one from the download + the one from the recovery) is complex and should be tested appropriately to determine if the feed is able to get the content in time.

// getFeedContent creates a feed with the given topic and user, and attempts to fetch its content using the given handler
func getFeedContent(ctx context.Context, handler feed.GenericHandler, topic feed.Topic, user common.Address) ([]byte, error) {
	fd := feed.Feed{
		Topic: topic,
		User:  user,
	}
	query := feed.NewQueryLatest(&fd, lookup.NoClue)
	//ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
        //defer cancel()

	_, err := handler.Lookup(ctx, query)
	// feed should still be queried even if there are no updates
	if err != nil && err.Error() != "no feed updates found" {
		return nil, ErrFeedLookup
	}

	_, content, err := handler.GetContent(&fd)
	if err != nil {
		return nil, ErrFeedContent
	}

	return content, nil
}

Metadata

Metadata

Labels

global pinningexperimental implementation of global pinningpriority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions