Skip to content

AccountManager fixes

Fabian Vogt requested to merge work/fvogt/fixpromises into release/22.12

With those fixes, I can send mails even if the access_token expired. Tested by editing the kwallet entry before sending a mail. Previously it failed because it didn't even attempt to refresh the token.

AccountManager: Don't keep finished promises in the cache

AccountPromises are destroyed one event loop cycle after they finished().
They won't emit finished() again, so they can't be used.
Don't cache promises for AccountManager::findAccount 

Unlike AccountManager::getAccount and AccountManager::refreshTokens, this
method does not return an authenticated account. However, the promises are
cached for all of them in the same store, so it was possible for a call to
e.g. refreshTokens to get a promise created by findAccount instead, resulting
in an unexpected result. Just don't cache promises created by findAccount.

For the latter I wonder whether the cache should also be dropped for getAccount and refreshTokens, or maybe have a method-specific cache e.g. by adding the method name to the cache key?

With !33 (merged), this should fix:

BUG: 406839 BUG: 409122 BUG: 421664 BUG: 456923

Edited by Fabian Vogt

Merge request reports