Skip to content

Missed New Day

DynaDev edited this page Aug 12, 2026 · 1 revision

Missed New Day Detection

TownyAlerts can optionally warn administrators when it starts after the expected Towny New Day time.

This is designed for situations such as:

  • The server was offline
  • TownyAlerts was not installed yet
  • TownyAlerts was disabled
  • DiscordSRV was not ready when the normal alert should have been sent

Configuration

missed-new-day:
  enabled: true
  lookback-hours: 12
  allow-log-fallback: true

The default recovery window is:

12 hours

Important distinction

TownyAlerts distinguishes between:

SCHEDULE_PASSED

and:

CONFIRMED_MISSED_NEW_DAY

These are intentionally different.

SCHEDULE_PASSED

Towny's scheduling APIs can determine the expected timing of New Day.

TownyAlerts uses Towny's public timing information, including:

TimeMgmt.townyTime()
TownySettings.getDayInterval()

TimeMgmt.townyTime() represents the number of seconds until the next Towny New Day.

From the schedule, TownyAlerts can calculate that the expected previous New Day time has passed.

This does not independently prove that the New Day actually executed.

Therefore the notification uses cautious wording.

It must not invent:

  • Upkeep totals
  • Tax totals
  • Bankrupt towns
  • Fallen towns
  • Fallen nations

CONFIRMED_MISSED_NEW_DAY

A missed New Day is only described as confirmed when TownyAlerts has reliable evidence.

In 1.0.0-beta.3, the fallback confirmation path can use an unequivocal Towny entry from the official current log when enabled.

missed-new-day:
  allow-log-fallback: true

Log fallback limits

TownyAlerts limits log inspection.

The current implementation targets:

logs/latest.log

and bounds the inspection to approximately:

  • 2 MiB
  • 20,000 lines

TownyAlerts does not scan unlimited historical logs.

Because only latest.log is inspected, confirmation may not be possible after log rotation or some restart scenarios.

No historical reconstruction guesses

If TownyAlerts cannot recover authoritative historical details, it sends a generic notice instead.

Current balances are never presented as if they were historical New Day balances.

Deduplication

Persistent SQLite/MariaDB/MySQL storage can prevent repeated missed-notice delivery for the same Towny cycle.

MEMORY mode does not persist across process restarts, so repeated starts inside the same recovery window may produce another notice.

No economy action

Missed New Day detection never:

  • Runs New Day
  • Charges taxes
  • Charges upkeep
  • Executes Towny admin commands
  • Changes balances

It is notification-only.

Clone this wiki locally