Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Conversation

@grokys
Copy link
Contributor

@grokys grokys commented May 26, 2016

Also remove what looked like incorrect logic in that if login failed, the login was read from cache.

grokys added 4 commits May 25, 2016 12:13
Previously, if an exception occurred while logging in to an account that
has previously been logged in, then an AccountCacheItem was read from
the cache and that was used. This meant we couldn't check the response's
scopes for gist support.
This way we only need to make 1 request at login.
{
return hostCache.GetAndRefreshObject("user",
() => apiClient.GetUser().Select(AccountCacheItem.Create), TimeSpan.FromMinutes(5), TimeSpan.FromDays(7))
() => apiClient.GetUser().Select(x => new AccountCacheItem(x.User)), TimeSpan.FromMinutes(5), TimeSpan.FromDays(7))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to keep with the convention of using Create methods on these calls, add an overload to AccountCacheItem.Create that takes a UserAndScopes object instead.

@shana
Copy link
Contributor

shana commented May 27, 2016

I debugged this some and yeah, logic looks about right. The whole login thing should definitely be cleaned up, it's waaay too complicated, but no point doing that here.

static readonly Logger log = LogManager.GetCurrentClassLogger();
static readonly Uri userEndpoint = new Uri("user", UriKind.Relative);

const string ProductName = Info.ApplicationInfo.ApplicationDescription;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reorder these so that const string and static readonly definitions are grouped together?

Nitpick Nancy on the prowl
nitpick_nancy

@shana shana merged commit 68f5e87 into grokys/feature/gist-support May 27, 2016
@shana shana deleted the grokys/scope-read-optimize branch May 27, 2016 20:51
@shana
Copy link
Contributor

shana commented May 27, 2016

bb8_thumbs_up

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants