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

lookup timeout on feed content recovery #2210

Open
santicomp2014 opened this issue Jun 23, 2020 · 0 comments
Open

lookup timeout on feed content recovery #2210

santicomp2014 opened this issue Jun 23, 2020 · 0 comments
Assignees
Labels
global pinning experimental implementation of global pinning priority

Comments

@santicomp2014
Copy link
Contributor

santicomp2014 commented Jun 23, 2020

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
}
@santicomp2014 santicomp2014 added the global pinning experimental implementation of global pinning label Jun 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
global pinning experimental implementation of global pinning priority
Projects
None yet
Development

No branches or pull requests

2 participants