flow_stats as long running task

Reviewer: @rlane

Convert flow_stats handler to run as long running task.

Also populate table_id for aggregate_stats handler, fixing flow_stats.AggregateStats.