Rishav/52 : adding cleanup and commands left in /health#54
Open
rishavvajpayee wants to merge 2 commits intodicedb:masterfrom
Open
Rishav/52 : adding cleanup and commands left in /health#54rishavvajpayee wants to merge 2 commits intodicedb:masterfrom
rishavvajpayee wants to merge 2 commits intodicedb:masterfrom
Conversation
aasifkhan7
approved these changes
Nov 26, 2024
aasifkhan7
suggested changes
Nov 26, 2024
| func (s *HTTPServer) getCommandsLeft() (int64, error) { | ||
| configValue := config.LoadConfig() | ||
| currentWindow := time.Now().Unix() / int64(configValue.Server.RequestWindowSec) | ||
| key := fmt.Sprintf("request_count:%d", currentWindow) |
Contributor
There was a problem hiding this comment.
you can reuse this part of the function @rishavvajpayee
Contributor
|
@rishavvajpayee Currently, x-next-cleanup-time returns the number of seconds remaining until the next cleanup. However, in this PR, it seems you're setting it to represent the exact timestamp of the next cleanup in the health check endpoint. |
aasifkhan7
suggested changes
Nov 27, 2024
| } | ||
|
|
||
| w.Header().Set("x-next-cleanup-time", strconv.FormatInt(nextCleanup, 10)) | ||
| w.Header().Set("x-commands-left", strconv.FormatInt(commandsLeft, 10)) |
Contributor
There was a problem hiding this comment.
@rishavvajpayee To enable Chrome or other browsers to access certain response headers, you need to include them in the Access-Control-Expose-Headers header. This ensures the specified headers are accessible to client-side scripts.
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.
( not added tests )