Skip to content
This repository was archived by the owner on Jan 31, 2026. It is now read-only.

refactor: bpt-queue Code Improvements: Debugging, Queue Management and Hardcap Disable#1036

Merged
bitpredator merged 2 commits intomainfrom
dev-bitpredator
Mar 19, 2025
Merged

refactor: bpt-queue Code Improvements: Debugging, Queue Management and Hardcap Disable#1036
bitpredator merged 2 commits intomainfrom
dev-bitpredator

Conversation

@bitpredator
Copy link
Owner

  1. Improved DebugPrint
  • Added timestamp: Each debug message now includes a timestamp showing the exact time the message was printed. This helps to track operations over time.
  • Improved formatting: The message formatting has been made clearer by including the timestamp in a readable format.
  1. Disabling hardcap resource
  • Checking the resource before stopping it: Before calling StopResource("hardcap"), a check has been added (GetResourceState("hardcap") == "started") to verify that the resource is actually active. This prevents errors or unnecessary calls when the resource is not running.
  • Protection from repeated calls: Introduced the hardcapDisabled variable to ensure that disabling the resource only happens once, avoiding conflicts or double calls.
  • Improved error messages: If the hardcap resource is not active and cannot be stopped, an error message is printed to better handle cases where the resource cannot be stopped.
  1. Readability and maintainability improvements
  • More modular code: Made the code more structured and easy to follow, by introducing explicit checks for resource management and protection against repeated operations.
  • Clear debug messages: Debug messages are now more informative, with details on what is happening and when, thanks to the addition of a timestamp.
  • Avoid unnecessary operations: Operations such as stopping the hardcap resource are now conditional, avoiding execution of actions when unnecessary.
  1. Avoid conflicts or errors
  • Avoid calling StopResource if the resource is not running: Adding the GetResourceState("hardcap") == "started" check prevents a resource from being stopped that is not currently active, reducing the risk of errors.
  1. Improved resource health check
  • Check resource load before stopping it: Introducing a check before stopping a resource helps ensure that it runs only when needed, improving performance and reducing unsolicited operations.

Fixes #[issue_no]

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Does your submission pass tests?

Please describe the changes this PR makes and why it should be merged:

Discord username (if different from GitHub):

1. Improved DebugPrint
- Added timestamp: Each debug message now includes a timestamp showing the exact time the message was printed.
This helps to track operations over time.
- Improved formatting: The message formatting has been made clearer by including the timestamp in a readable format.

2. Disabling hardcap resource
- Checking the resource before stopping it: Before calling StopResource("hardcap"), a check has been added (GetResourceState("hardcap") == "started") to verify that the resource is actually active.
This prevents errors or unnecessary calls when the resource is not running.
- Protection from repeated calls: Introduced the hardcapDisabled variable to ensure that disabling the resource only happens once, avoiding conflicts or double calls.
- Improved error messages: If the hardcap resource is not active and cannot be stopped, an error message is printed to better handle cases where the resource cannot be stopped.

3. Readability and maintainability improvements
- More modular code: Made the code more structured and easy to follow, by introducing explicit checks for resource management and protection against repeated operations.
- Clear debug messages: Debug messages are now more informative, with details on what is happening and when, thanks to the addition of a timestamp.
- Avoid unnecessary operations: Operations such as stopping the hardcap resource are now conditional, avoiding execution of actions when unnecessary.

4. Avoid conflicts or errors
- Avoid calling StopResource if the resource is not running: Adding the GetResourceState("hardcap") == "started" check prevents a resource from being stopped that is not currently active, reducing the risk of errors.

5. Improved resource health check
- Check resource load before stopping it: Introducing a check before stopping a resource helps ensure that it runs only when needed, improving performance and reducing unsolicited operations.
@bitpredator bitpredator merged commit 70706d0 into main Mar 19, 2025
6 of 7 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant