File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func mcacheItemExpired(key string, _ interface{}) {
5454 log .Debugf ("Cleared SA from mcache: %s" , key )
5555}
5656
57- func addServiceAccountsToTempCache (serviceAccounts []* RemoteServiceAccount , duration time. Duration ) {
57+ func addServiceAccountsToTempCache (serviceAccounts []* RemoteServiceAccount ) {
5858 for _ , sa := range serviceAccounts {
5959 mcache .Set (sa .ServiceAccountPath , nil )
6060 }
@@ -218,8 +218,8 @@ func (m *ServiceAccountManager) GetServiceAccount(remotePaths ...string) ([]*Rem
218218 // were service accounts found?
219219 if err == nil && m .parallelism > 1 && len (serviceAccounts ) > 0 {
220220 // there may be multiple routines requesting service accounts
221- // prevent service account from being re-used (unless explicitly removed by a successful operation)
222- addServiceAccountsToTempCache (serviceAccounts , 24 * time . Hour )
221+ // attempt to prevent service account from being re-used (unless explicitly removed by a successful operation)
222+ addServiceAccountsToTempCache (serviceAccounts )
223223 }
224224
225225 return serviceAccounts , err
Original file line number Diff line number Diff line change @@ -83,5 +83,6 @@ func (ws *Server) ServiceAccountHandler(c *fiber.Ctx) {
8383 // (so if another gclone transfer routine requests within N duration, re-issue the same sa)
8484 ws .saCache .cache [sa [0 ].ServiceAccountPath ] = cacheEntry
8585
86+ // return service account
8687 c .SendString (sa [0 ].ServiceAccountPath )
8788}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import (
1414/* Const */
1515
1616const (
17- maxSaCacheHits int = 6
17+ maxSaCacheHits int = 4
1818 durationSaCacheEntry time.Duration = 10 * time .Second
1919)
2020
You can’t perform that action at this time.
0 commit comments