-
Notifications
You must be signed in to change notification settings - Fork 41
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
IS-450 Reload rotation timestamp on each isExitTime request #1757
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e725930
Reload rotation timestamp in isTimeToRotate
badrogger 5d8a88d
Rename getRotationTimestamp -> rotationTimestamp
badrogger 85c1b31
Add logs
badrogger dd6fdae
Fix Net tests
badrogger f59f486
Merge branch 'v3.18.0' into reload-rotation-timestamp
badrogger b3f1c07
Handle malformed/missing rotationInfoFile
badrogger 573f3c0
Rename rotation.txt -> rotation.json
badrogger 1600857
Add error logger in InstanceMonitor
badrogger 1785847
Rename m_info_logger -> m_infoLogger
badrogger 53ecf1e
Merge branch 'v3.18.0' into reload-rotation-timestamp
DmytroNazarenko 9ce9d5c
Merge branch 'v3.18.0' into reload-rotation-timestamp
badrogger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,30 +36,39 @@ | |
public: | ||
explicit InstanceMonitor( const boost::filesystem::path& _rotationInfoFileDirPath, | ||
std::shared_ptr< StatusAndControl > _statusAndControl = nullptr ) | ||
: m_finishTimestamp( 0 ), | ||
m_rotationInfoFilePath( _rotationInfoFileDirPath / rotation_info_file_name ), | ||
: m_rotationInfoFilePath( _rotationInfoFileDirPath / rotation_info_file_name ), | ||
m_statusAndControl( _statusAndControl ) { | ||
restoreRotationParams(); | ||
reportExitTimeReached( false ); | ||
} | ||
void prepareRotation(); | ||
void initRotationParams( uint64_t _finishTimestamp ); | ||
bool isTimeToRotate( uint64_t _finishTimestamp ); | ||
bool isTimeToRotate( uint64_t _blockTimestamp ) const; | ||
|
||
protected: | ||
void restoreRotationParams(); | ||
[[nodiscard]] uint64_t finishTimestamp() const { return m_finishTimestamp; } | ||
|
||
[[nodiscard]] uint64_t rotationTimestamp() const; | ||
[[nodiscard]] fs::path rotationInfoFilePath() const { return m_rotationInfoFilePath; } | ||
|
||
uint64_t m_finishTimestamp; | ||
const fs::path m_rotationInfoFilePath; | ||
std::shared_ptr< StatusAndControl > m_statusAndControl; | ||
|
||
static const std::string rotation_info_file_name; | ||
|
||
void reportExitTimeReached( bool _reached ); | ||
|
||
class InvalidRotationInfoFileException : public std::exception { | ||
protected: | ||
std::string what_str; | ||
|
||
public: | ||
boost::filesystem::path path; | ||
|
||
InvalidRotationInfoFileException( const boost::filesystem::path& _path ) : path( _path ) { | ||
what_str = "File " + path.string() + " is malformed or missing"; | ||
} | ||
virtual const char* what() const noexcept override { return what_str.c_str(); } | ||
}; | ||
|
||
|
||
private: | ||
dev::Logger m_logger{ createLogger( dev::VerbosityInfo, "instance-monitor" ) }; | ||
mutable dev::Logger m_logger{ createLogger( dev::VerbosityInfo, "instance-monitor" ) }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mutable is not needed here |
||
}; |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to write information about rotation into logs