Surface Token Management to UX #457

Merged
dan merged 3 commits from surface-tokens into master 2022-09-07 16:39:54 +00:00
1 changed files with 3 additions and 2 deletions
Showing only changes of commit f46c717ff9 - Show all commits

View File

@ -41,6 +41,7 @@ func (e *engine) NewTokenHandler(tokenService string, tokens []*privacypass.Toke
func (e *engine) FetchToken(tokenService string) (*privacypass.Token, int, error) {
tokenManagerPointer, _ := e.tokenManagers.LoadOrStore(tokenService, new(TokenManager))
tokenManager := tokenManagerPointer.(*TokenManager)
e.eventManager.Publish(event.NewEvent(event.TokenManagerInfo, map[event.Field]string{event.ServerTokenOnion: tokenService, event.ServerTokenCount: strconv.Itoa(tokenManager.NumTokens())}))
return tokenManager.FetchToken()
token, numTokens, err := tokenManager.FetchToken()
e.eventManager.Publish(event.NewEvent(event.TokenManagerInfo, map[event.Field]string{event.ServerTokenOnion: tokenService, event.ServerTokenCount: strconv.Itoa(numTokens)}))
return token, numTokens, err
}