This PR fix potential issues with large event queues due to the unstable network and too many events being tracked within short period of time.
make archive/unarchive always respect queue size limit (since we merge the flush queue and the tracking queue together, without this change, there is a possibility to go over the limit)
save progress during flushing a queue, call archive right after each batch of events being flushed successfully, this is to prevent sending duplicated events or losing events when app being terminated during the flush before it has a chance to archive the whole thing.
make archive always to be called inside a network queue, this is to prevent race conditions for both the flush queue and the track queue. The flush queue and track queue transitions happens in network queue so archive should always be in the same queue.
This PR fix potential issues with large event queues due to the unstable network and too many events being tracked within short period of time.