inline application observer code
pragma
start flush timer on main queue
end background task if there isn't anything to flush