Cache GitLab responses to avoid spamming the GitLab server#126
Open
dejan9393 wants to merge 2 commits intobufferoverflow:masterfrom
Open
Cache GitLab responses to avoid spamming the GitLab server#126dejan9393 wants to merge 2 commits intobufferoverflow:masterfrom
dejan9393 wants to merge 2 commits intobufferoverflow:masterfrom
Conversation
6261a7b to
4322309
Compare
bbenoist
reviewed
Apr 15, 2021
src/gitlabcache.ts
Outdated
|
|
||
| private static _generateKeyHash(username: string, password: string) { | ||
| const sha = Crypto.createHash('sha256'); | ||
| sha.update(JSON.stringify({ username: username, password: password })); |
There was a problem hiding this comment.
Tip: You can directly use sha.update(JSON.stringify({ username, password })); since username and password properties shares the same name...
src/gitlabcache.ts
Outdated
Comment on lines
14
to
16
| public static get DEFAULT_TTL() { | ||
| return 300; | ||
| } |
There was a problem hiding this comment.
Please excuse my question but why did you use a getter instead of public readonly DEFAULT_TTL = 300;?
Author
There was a problem hiding this comment.
Because this was basically a quick hackjob, copied from authcache.ts.
968e75d to
99c0119
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #125