From ecfcf11adbb44c1b532994d434279ace0c55f9dc Mon Sep 17 00:00:00 2001 From: Joshua Blum Date: Fri, 23 Jan 2026 12:48:33 -0500 Subject: [PATCH] store resourceID when renewing channel --- gcalbot/gcalbot/db.go | 6 +++--- gcalbot/gcalbot/webhook.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcalbot/gcalbot/db.go b/gcalbot/gcalbot/db.go index d693cb4..08514cd 100644 --- a/gcalbot/gcalbot/db.go +++ b/gcalbot/gcalbot/db.go @@ -179,13 +179,13 @@ func (d *DB) InsertChannel(account *Account, channel Channel) error { }) } -func (d *DB) UpdateChannel(oldChannelID, newChannelID string, expiry time.Time) error { +func (d *DB) UpdateChannel(oldChannelID, newChannelID string, resourceID string, expiry time.Time) error { return d.RunTxn(func(tx *sql.Tx) error { _, err := tx.Exec(` UPDATE channel - SET channel_id = ?, expiry = ? + SET channel_id = ?, resource_id = ?, expiry = ? WHERE channel_id = ? - `, newChannelID, expiry, oldChannelID) + `, newChannelID, resourceID, expiry, oldChannelID) return err }) } diff --git a/gcalbot/gcalbot/webhook.go b/gcalbot/gcalbot/webhook.go index 3f9732d..2d2097e 100644 --- a/gcalbot/gcalbot/webhook.go +++ b/gcalbot/gcalbot/webhook.go @@ -428,7 +428,7 @@ func (r *RenewChannelScheduler) renewChannel(account *Account, channel *Channel) return err } - err = r.db.UpdateChannel(channel.ChannelID, newChannelID, time.Unix(res.Expiration/1e3, 0)) + err = r.db.UpdateChannel(channel.ChannelID, newChannelID, res.ResourceId, time.Unix(res.Expiration/1e3, 0)) if err != nil { return err }