Improved: add redis.end() after publish a key