Skip to content

Commit

Permalink
fix: fix idling for high cpu usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kazami139 authored and GitHub Enterprise committed Mar 25, 2023
1 parent d404aee commit e49563d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions internal/app/api/service/bilbil_picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ func (c *RandomPicsCache) Run() error {
c.flush()
}()
go func(_tk *time.Ticker) {
for {
select {
case <-_tk.C:
c.flush()
default:
continue
}
// for {
// select {
// case <-_tk.C:
// c.flush()
// default:
// continue
// }
// }
for _ = range _tk.C {
c.flush()
}
}(tk)
return nil
Expand Down

1 comment on commit e49563d

@kazami139
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#26

Please sign in to comment.