Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

Addresses remaining review comment from PR #7: webhook payload timestamps were being set inside the Send method after goroutine dispatch, introducing delays between event occurrence and recorded timestamp.

Change

Set Timestamp field when constructing the payload, before launching the background goroutine:

payload := notify.Payload{
    Event:     event,
    Message:   message,
    Details:   details,
    Timestamp: time.Now(), // Captured at event occurrence, not at send time
}

go func() {
    // ... send webhook asynchronously
    err := h.webhook.Send(ctx, payload)
}()

Previously, time.Now() was called inside Send, which executed after goroutine scheduling delays. Timestamps now accurately reflect when events occurred (bootstrap failures, health transitions, circuit renewals), not when HTTP requests were initiated.

The Send method still defaults the timestamp if not set (backwards compatibility), but all callers now provide explicit timestamps.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 192.0.2.1
    • Triggering command: /tmp/go-build206135023/b270/tor.test /tmp/go-build206135023/b270/tor.test -test.testlogfile=/tmp/go-build206135023/b270/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 0.1-go1.25.0.lin--gdwarf-5 (packet block)
    • Triggering command: /tmp/go-build408908709/b273/tor.test /tmp/go-build408908709/b273/tor.test -test.testlogfile=/tmp/go-build408908709/b273/testlog.txt -test.paniconexit0 -test.timeout=10m0s go1.25.0 -c=4 -nolocalimports -importcfg /tmp/go-build661516655/b123/importcfg -pack /home/REDACTED/work/Torarr/Torarr/internal/notify/webhook.go /home/REDACTED/work/Torarr/Torarr/internal/notify/webhook_test.go (packet block)
    • Triggering command: /tmp/go-build3874705941/b275/tor.test /tmp/go-build3874705941/b275/tor.test -test.testlogfile=/tmp/go-build3874705941/b275/testlog.txt -test.paniconexit0 -test.timeout=10m0s TlQdabMKoXb-i_IKrIRy/TlQdabMKoXb-i_IKrIRy -goversion go1.25.0 -c=4 -race -nolocalimports -importcfg /tmp/go-build3874705941/b194/importcfg (packet block)
  • https://api.github.com/repos/eslutz/Torarr/pulls/7/reviews
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

open a new pull request to apply changes based on the comments in this thread


💡 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.

Co-authored-by: eslutz <67699321+eslutz@users.noreply.github.com>
Copilot AI changed the title [WIP] Apply changes based on review comments Set webhook payload timestamp at event occurrence time Jan 6, 2026
Copilot AI requested a review from eslutz January 6, 2026 11:08
@eslutz eslutz requested a review from Copilot January 6, 2026 11:22
@eslutz eslutz marked this pull request as ready for review January 6, 2026 11:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a timing issue where webhook payload timestamps were incorrectly set after goroutine dispatch, causing delays between event occurrence and recorded timestamp. The fix ensures timestamps accurately reflect when events occurred.

  • Sets Timestamp field during payload construction before launching background goroutine
  • Preserves backwards compatibility in Send method which still defaults timestamp if not set
  • Improves timestamp accuracy for all webhook events (bootstrap failures, health transitions, circuit renewals)

@eslutz eslutz merged commit aa678b8 into main Jan 6, 2026
6 checks passed
@eslutz eslutz deleted the copilot/apply-review-comments-changes branch January 6, 2026 20:26
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