-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Feat/purge messages upto 24 hrs in current channel #982
base: develop
Are you sure you want to change the base?
Feat/purge messages upto 24 hrs in current channel #982
Conversation
* enum will hold duration constants for feature * tiny fixes in message for user of command * hrs-> hr for single message and in x hrs -> within x hrs
application/src/main/java/org/togetherjava/tjbot/features/moderation/history/Duration.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/togetherjava/tjbot/features/moderation/history/MessageHistoryRoutine.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/togetherjava/tjbot/features/moderation/history/MessageHistoryRoutine.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/togetherjava/tjbot/features/moderation/history/MessageHistoryRoutine.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/togetherjava/tjbot/features/moderation/history/MessageHistoryRoutine.java
Outdated
Show resolved
Hide resolved
...n/src/main/java/org/togetherjava/tjbot/features/moderation/history/PurgeMessageListener.java
Show resolved
Hide resolved
...n/src/main/java/org/togetherjava/tjbot/features/moderation/history/PurgeMessageListener.java
Show resolved
Hide resolved
...n/src/main/java/org/togetherjava/tjbot/features/moderation/history/PurgeMessageListener.java
Outdated
Show resolved
Hide resolved
...n/src/main/java/org/togetherjava/tjbot/features/moderation/history/PurgeMessageListener.java
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/features/moderation/history/Duration.java
Outdated
Show resolved
Hide resolved
private static final int MESSAGES_RECORDS_MAX_LIMIT = 7500; | ||
private static final int MESSAGES_RECORDS_THRESHOLD = MESSAGES_RECORDS_MAX_LIMIT - 100; | ||
private static final int RECORDS_TO_TRIM = 500; | ||
static AtomicInteger recordsCounter = new AtomicInteger(0); |
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.
since the PR is getting too old now and so much stuff to review , flagging the important bit, is using atomic justified here?
the goal is to limit only certain no of db entries(recordsCounter), which is modified across package in PurgeMessageListener
(incrementCounterByOne) on each new message and in both PurgeHistoryCommand
and PurgeExpiredMessageHistory
(decrementCountByOne) on each deletion of record/message.
converting this PR to draft, feel like it needs a bit of refactoring considering moderation usecase per channel basis might not be suited anymore. |
For earlier context related to PR, #945
resolves #912
Workflow
Includes
/purge-in-channel
.Additions
Command Interface
when there's no records:
if there's any records within selected duration:
Note: Duration is optional, if skipped it defaults to last hour.