Skip to content

Commit 8b5fe3a

Browse files
committed
🎨 improve strucure
1 parent a34c3f0 commit 8b5fe3a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/util/token-util.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export async function getFreshAccessToken(
118118
return newToken.accessToken;
119119
}
120120

121-
export async function updateToken(
121+
export async function updateProviderKey(
122122
config: Config,
123123
accessToken: string,
124124
providerKey: string,
@@ -129,13 +129,16 @@ export async function updateToken(
129129
'Tried getting token from cache while cache was undefined.',
130130
);
131131
}
132+
132133
const newToken = { accessToken, isPending: false };
133134
await tokenCache.set(providerKey, newToken, getTokenCacheTtl());
134135
const { PUBSUB_TOPIC_NAME_UPDATE_PROVIDER_KEY } = process.env;
136+
135137
assert(
136138
PUBSUB_TOPIC_NAME_UPDATE_PROVIDER_KEY,
137139
'PUBSUB_TOPIC_NAME_UPDATE_PROVIDER_KEY is not defined',
138140
);
141+
139142
const pubSubClient = new PubSubClient(PUBSUB_TOPIC_NAME_UPDATE_PROVIDER_KEY);
140143
await pubSubClient.publishMessage({
141144
userID: config.userId,

0 commit comments

Comments
 (0)