File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,9 +141,10 @@ export async function consume(arg) {
141141 } ;
142142 }
143143
144- // Hitting this point means the second latest token is used while the latest token is already
145- // issued, which might happen on race condition (e.g. user sends multiple requests in parallel).
146- // This token is still considered active, but cannot be used to rotate token.
144+ // Hitting this point means the second latest token is used in reqeust while the latest token is
145+ // already issued.
146+ // This might happen on a race condition where the client sends multiple requests simultaneously.
147+ // This second latest token is still considered active, but cannot be used to rotate token.
147148 if ( isToken2 ) {
148149 return { state : "Active" } ;
149150 }
@@ -167,6 +168,10 @@ export async function consume(arg) {
167168 } ,
168169 } ;
169170 }
171+
172+ // Hitting this point means the latest token is used and already expired.
173+ // We will rotate the token.
174+
170175 const nextToken = generate256BitEntropyHex ( ) ;
171176 const nextTokenHash = await hash ( nextToken ) ;
172177
You can’t perform that action at this time.
0 commit comments