Problem: resubscribe_at can be nil
All checks were successful
continuous-integration/drone/push Build is passing

Solution: allow nil values in resubscribe_at
This commit is contained in:
Peter Stuifzand 2021-11-20 22:07:38 +01:00
parent 8ba1b213d6
commit c47a7f7f2a
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -42,7 +42,7 @@ type Feed struct {
Hub string Hub string
Secret string Secret string
LeaseSeconds int64 LeaseSeconds int64
ResubscribeAt time.Time ResubscribeAt *time.Time
} }
var ( var (
@ -223,7 +223,7 @@ func (h *hubIncomingBackend) run() error {
for _, feed := range feeds { for _, feed := range feeds {
log.Printf("Looking at %s\n", feed.URL) log.Printf("Looking at %s\n", feed.URL)
if time.Now().After(feed.ResubscribeAt) { if feed.ResubscribeAt != nil && time.Now().After(*feed.ResubscribeAt) {
if feed.Callback == "" { if feed.Callback == "" {
feed.Callback = fmt.Sprintf("%s/incoming/%d", h.baseURL, feed.ID) feed.Callback = fmt.Sprintf("%s/incoming/%d", h.baseURL, feed.ID)
} }