We need to do this without holding the lock as the `g_async_queue_pop` waits on the loop thread to deliver the stats. The loop thread might attempt to take the lock as well, leading to a deadlock. Taking a reference to the connection should be enough to keep this safe.