Skip to content

v1.6.3

Choose a tag to compare

@Daiivr Daiivr released this 25 May 03:58

Bot Manager — Auto-refreshing "NEW RELEASE!" banner

🇬🇧 English

Why

The GitHub release check only ran once at startup (Main.cs:367). If a new version was published while the app was open, the "NEW RELEASE!" banner stayed hidden until the user closed and reopened the program.

What changed

  • Background polling timer. A System.Threading.Timer now re-queries the GitHub Releases API every 1 hour while the app is open, in addition to the existing startup check. The interval is exposed as a single constant (UpdateCheckInterval) so it's trivial to tune.
  • Banner appears live. When the periodic check detects a newer version, the result is marshalled to the UI thread via BeginInvoke and the banner animates in without requiring a restart.
  • Per-version dedupe. Added _lastSeenUpdateVersion. Even though the timer fires 24× per day, SetUpdateNotification(...) is only invoked once per new release detected at runtime — no spammy re-animations.
  • No surprise modals. The background call now passes showDialog: false to UpdateChecker.CheckForUpdatesAsync(...), so polling can never pop up an update dialog. The manual "Update" button still uses forceShow: true and behaves exactly as before.
  • Clean shutdown. Timer is disposed on FormClosed and an IsDisposed guard sits inside the callback as a belt-and-braces measure against late callbacks against a disposed UI.

Rate-limit safety

GitHub's unauthenticated API allows 60 requests/hour per IP. One request per hour per running instance is 1 req/hour — comfortably under the limit.

How to verify

  1. Open the app.
  2. Publish a new release on GitHub (or lower TradeBot.Version locally to force the check to find something newer).
  3. Within ≤ 1 hour the "NEW RELEASE!" banner appears on its own. No restart needed.

🇪🇸 Español

Por qué

El check de releases en GitHub se ejecutaba una sola vez al arrancar (Main.cs:367). Si publicabas una versión nueva con la app abierta, el banner "NEW RELEASE!" quedaba oculto hasta que el usuario cerrara y reabriera el programa.

Qué cambió

  • Timer de polling en background. Un System.Threading.Timer vuelve a consultar la API de GitHub Releases cada 1 hora mientras la app está abierta, además del check inicial al arrancar. El intervalo está expuesto como una constante (UpdateCheckInterval) para que sea trivial ajustarlo.
  • El banner aparece en vivo. Cuando el check periódico detecta una versión más reciente, el resultado se envía al hilo UI vía BeginInvoke y el banner se anima sin necesidad de reiniciar.
  • Dedupe por versión. Añadido _lastSeenUpdateVersion. Aunque el timer dispare 24 veces al día, SetUpdateNotification(...) solo se invoca una vez por release nuevo detectado en runtime — sin re-animaciones spammy.
  • Sin diálogos por sorpresa. La llamada en background ahora pasa showDialog: false a UpdateChecker.CheckForUpdatesAsync(...), así que el polling jamás abre una ventana modal. El botón manual de "Update" sigue usando forceShow: true y se comporta exactamente igual que antes.
  • Shutdown limpio. El timer se libera en FormClosed y un guard IsDisposed dentro del callback funciona como red de seguridad contra callbacks tardíos sobre una UI ya disposed.

Seguridad de rate-limits

La API pública de GitHub permite 60 requests/hora por IP sin autenticar. Una request por hora por instancia = 1 req/hora — cómodamente por debajo del límite.

Cómo verificarlo

  1. Abre la app.
  2. Publica un release nuevo en GitHub (o baja TradeBot.Version localmente para forzar que el check encuentre algo más nuevo).
  3. En ≤ 1 hora el banner "NEW RELEASE!" aparece solo. Sin reiniciar.