Modified session management. If the task isn't finished within one
second, we store the taskid, otherwise there's no need to do it.