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 }