Skip to content

Add countdown timer to API post delay for ping operations#27

Merged
MrAlders0n merged 2 commits into
mainfrom
copilot/update-wait-to-post-api
Dec 18, 2025
Merged

Add countdown timer to API post delay for ping operations#27
MrAlders0n merged 2 commits into
mainfrom
copilot/update-wait-to-post-api

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 18, 2025

The API post status message was static text with no indication of remaining time. Both manual and auto ping modes now display a countdown during the 7-second MeshMapper API delay.

Changes

Status Display

  • Changed message from "Waiting for API post" to "Wait to post API (Xs)" where X counts down 7→1
  • Shows "Posting to API..." when countdown completes

Implementation

  • Added updateApiCountdownStatus() - calculates and displays remaining time
  • Added startApiCountdown(delayMs) - initializes countdown with 1s update interval
  • Added stopApiCountdown() - cleanup to prevent memory leaks
  • Modified sendPing() to trigger countdown after STATUS_UPDATE_DELAY_MS
  • Added countdown cleanup in disconnect handler

State Management

  • apiCountdownTimer - stores interval ID
  • apiPostTime - target timestamp for API post

Pattern

Follows existing auto-ping countdown implementation:

function startApiCountdown(delayMs) {
  stopApiCountdown();
  state.apiPostTime = Date.now() + delayMs;
  updateApiCountdownStatus();
  state.apiCountdownTimer = setInterval(() => {
    updateApiCountdownStatus();
  }, 1000);
}

Applies to both manual "Send Ping" and "Auto Ping" modes.

Original prompt

The last merge fixed all the issues I had.

Id like to make a change to both ping and auto ping now.

I want to rework "Waiting for API post" to Wait to post API" and provide a count down for that as well. Whatever its set to, currently its 7s to countdown to 0s


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Changed "Waiting for API post" to "Wait to post API"
- Added countdown display from 7s to 0s during API post delay
- Implemented startApiCountdown, stopApiCountdown, and updateApiCountdownStatus functions
- Added state variables apiCountdownTimer and apiPostTime
- Countdown updates every second similar to auto-ping countdown
- Clean up API countdown timer on disconnect

Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Copilot AI changed the title [WIP] Update waiting for API post message and add countdown Add countdown timer to API post delay for ping operations Dec 18, 2025
Copilot AI requested a review from MrAlders0n December 18, 2025 00:08
@MrAlders0n MrAlders0n marked this pull request as ready for review December 18, 2025 00:10
@MrAlders0n MrAlders0n merged commit 372fbaa into main Dec 18, 2025
@MrAlders0n MrAlders0n deleted the copilot/update-wait-to-post-api branch December 18, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants