WidgetKit Timeline provider: Refresh the timeline every five minutes

My widget is supposed to connect to a server and fetch data every five minutes. Instead of being called for a new timeline after five minutes, timeline(with context: Context, completion: @escaping (Timeline<Self.Entry>) -> ()) method is called several times in a second. To figure out what I am doing wrong, I've simplified the method and added just a simple random number generator instead of calling the API.

Code Block
func timeline(with context: Context, completion: @escaping (Timeline<Self.Entry>) -> ()) {
    let currentDate = Date()
    let futureDate = Calendar.current.date(byAdding: .minute, value: 5, to: currentDate)!
    let timeline = Timeline(entries: [
      Entry(date: currentDate, city: "\(Int.random(in: 0...10))"),
    ], policy: .after(futureDate))
    completion(timeline)
  }

The method is called several times in a second. I have no idea if I am doing something wrong or this is a bug in iOS 14?


Seems to be a bug, I'm see it and others have been reporting the same issue as well on here.
WidgetKit Timeline provider: Refresh the timeline every five minutes
 
 
Q