Skip to content

Guard the channel receive in certHandler #121

Closed

Description

@messede-degod

We should perhaps guard the channel receive here:

for {
entry := <-entryChan
processed++
if processed%1000 == 0 {
log.Printf("Processed %d entries | Queue length: %d\n", processed, len(entryChan))
// Every thousandth entry, we store one certificate as example
web.SetExampleCert(entry)
}
// Run JSON encoding in the background and send the result to the clients.
broadcast.ClientHandler.MessageQueue <- entry
// Update metrics
url := entry.Data.Source.NormalizedURL
operator := entry.Data.Source.Operator
index := entry.Data.CertIndex
metrics.Metrics.Inc(operator, url, index)
}

to

 entry,ok := <-entryChan 
 if !ok{
   break
 }
  1. its possible that we are burning CPU untill the app fully shutsdown
  2. there is also a possibility of empty values being pushed to consumers ?

Activity

  1. messede-degod commented on Sep 21, 2026

    @messede-degod
    ContributorAuthor

    Fixed here: #124

  2. messede-degod commented on Sep 27, 2026

    @messede-degod
    ContributorAuthor

    Closed by: #124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions