Make "Truncate Length" and "Limit of Messages" optional

Created on 3 May 2023, over 1 year ago

Problem/Motivation

With the release of version 1.0 it added the following two features which not all sites will want to utilize:

  • Truncate Length for notifications
  • Limit of Messages per Run

While they have good intentions, they should not be always enforced.

The Truncate Length for notifications value technically has code in SlackLog::log() which will ignore truncation if the value is 0, but validation in the configuration form will not allow the value to be set below 50.

While Limit of Messages per Run value could technically be ignored by setting to a very high value, the logic in SlackLog::incrementRateCounter() ends up executing 3 DB calls per slack message which is wasteful if not using this feature.

Proposed resolution

  1. Make the configuration values optional by setting the values to 0
  2. Add logic to SlackLog to ignore message per minute functionality if Limit of Messages per Run is 0
Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇨🇦Canada mdolnik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mdolnik
  • 🇨🇦Canada mdolnik

    Added a patch for the proposed changes.

    1. Changed the configuration values to have minimum value of 0
    2. Updated configuration description to suggest setting values to 0 will omit functionality
    3. Add logic to SlackLog::log() to ignore message per minute functionality if Limit of Messages per Run is 0
    4. Updated SlackLog::log() utilize (int) casting instead of intval() because the casting is more efficient
  • Status changed to Needs review over 1 year ago
Production build 0.71.5 2024