Processing data from UDF after outage in kapacitor

Hi All,
Consider, a kapacitor task(tick script) runs a batch query for every 5 mins and sends it to Kapacitor UDF for processing.
Data written to influxDB from telegraf is continuous. Now kapacitor goes down for 30 mins and start again.
Now, in influxDB data is available for last 30 mins but our kapacitor task is only takes last 5 mins data and process it and leaves 25mins of unprocessed data in influxDB.

Is there any way to handle this type of situation ?