Add optional cookiejar and open node integration #139
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR stems from a behavior of the open node, which sits behind a cloudflare load balancer. The nodes are not synchronized to each other, so making two sequential requests may mean the second request hits a node that has not progressed as far. This behavior can be seen clearly when polling the open node for the "current minute":
https://gist.github.com/WhoSoup/5b23022bea3d2d792c34fc1795975d09
Cloudflare has support for funneling the same client ip to the same instance, though as of today it doesn't seem to be working well. It can also achieve this via use of session cookies.
This PR does two things:
factom.EnableCookies()), which uses golang's built in cookie supportfactom.SetOpenNode()), which automatically enables cookie supportfactom.OpenNodecontaining the default open node api urlI wasn't sure if it's okay to just enable cookie support by default. Factomd doesn't use them, so it would have no effect