commit every 1000 messages