Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove require for conf in jwttokenmanager.js #50

Closed

Conversation

Bhaveshdhapola
Copy link
Contributor

No description provided.

@@ -28,7 +28,7 @@ function initSync() {

if (TOKENMANCONF.useGlobalMemory) TOKEN_MEMORY = _ => DISTRIBUTED_MEMORY; else TOKEN_MEMORY = _ => CLUSTER_MEMORY;

try {conf = require(TOKENMANCONF);} catch (err) {conf = {}}
try {conf = TOKENMANCONF;} catch (err) {conf = {}}
Copy link
Owner

Choose a reason for hiding this comment

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

Catch is redundant, secondly having 2 variables - conf and TOKENMANCONF is also wrong.

If you are submitting a fix - please fix correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Rohit,

It is better to remove the conf variable and directly use TOKENMANCONF and we can remove the try-catch block as the conf variable is not required. We can use the below code:

TOKENMANCONF.expiryInterval = TOKENMANCONF?.expiryInterval || DEFAULT_TOKEN_EXPIRY; 
    TOKENMANCONF.tokenGCInterval = TOKENMANCONF?.tokenGCInterval || DEFAULT_GC_INTERVAL;

    setInterval(_cleanTokens, TOKENMANCONF.tokenGCInterval);   
    ```
    
    Could you please review the above code?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes that was my point!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, Rohit. Closing this PR and raising a new one.

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.

2 participants