save chat log at mongo if chat log exceed 40 and left 20 messages at redis