Skip to content

Commit ecfcf11

Browse files
committed
store resourceID when renewing channel
1 parent 232322a commit ecfcf11

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

gcalbot/gcalbot/db.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ func (d *DB) InsertChannel(account *Account, channel Channel) error {
179179
})
180180
}
181181

182-
func (d *DB) UpdateChannel(oldChannelID, newChannelID string, expiry time.Time) error {
182+
func (d *DB) UpdateChannel(oldChannelID, newChannelID string, resourceID string, expiry time.Time) error {
183183
return d.RunTxn(func(tx *sql.Tx) error {
184184
_, err := tx.Exec(`
185185
UPDATE channel
186-
SET channel_id = ?, expiry = ?
186+
SET channel_id = ?, resource_id = ?, expiry = ?
187187
WHERE channel_id = ?
188-
`, newChannelID, expiry, oldChannelID)
188+
`, newChannelID, resourceID, expiry, oldChannelID)
189189
return err
190190
})
191191
}

gcalbot/gcalbot/webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ func (r *RenewChannelScheduler) renewChannel(account *Account, channel *Channel)
428428
return err
429429
}
430430

431-
err = r.db.UpdateChannel(channel.ChannelID, newChannelID, time.Unix(res.Expiration/1e3, 0))
431+
err = r.db.UpdateChannel(channel.ChannelID, newChannelID, res.ResourceId, time.Unix(res.Expiration/1e3, 0))
432432
if err != nil {
433433
return err
434434
}

0 commit comments

Comments
 (0)