Skip to content

Conversation

dejan9393
Copy link

Fixes #125

@dejan9393 dejan9393 force-pushed the #125-cache-gitlab-api-promises branch from 6261a7b to 4322309 Compare March 10, 2021 05:12

private static _generateKeyHash(username: string, password: string) {
const sha = Crypto.createHash('sha256');
sha.update(JSON.stringify({ username: username, password: password }));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip: You can directly use sha.update(JSON.stringify({ username, password })); since username and password properties shares the same name...

Comment on lines 14 to 16
public static get DEFAULT_TTL() {
return 300;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please excuse my question but why did you use a getter instead of public readonly DEFAULT_TTL = 300;?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this was basically a quick hackjob, copied from authcache.ts.

@dejan9393 dejan9393 force-pushed the #125-cache-gitlab-api-promises branch from 968e75d to 99c0119 Compare April 15, 2021 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitLab API results are not cached, causes high CPU usage on GitLab server
2 participants