diff --git a/extend/lbson/src/bson.h b/extend/lbson/src/bson.h index a2777118..d039f1aa 100644 --- a/extend/lbson/src/bson.h +++ b/extend/lbson/src/bson.h @@ -111,7 +111,6 @@ namespace lbson { } int date(lua_State* L, int64_t value) { - value = value * 1000; return make_bson_value(L, bson_type::BSON_DATE, (const char *)&value, sizeof(value)); } @@ -191,12 +190,6 @@ namespace lbson { return sprintf(str, "%zd", i); } - void write_date(lua_State* L) { - lua_getfield(L, -1, "date"); - m_buffer.write((lua_tointeger(L, -1) * 1000)); - lua_pop(L, 1); - } - void write_int64(lua_State* L) { lua_getfield(L, -1, "value"); m_buffer.write(lua_tointeger(L, -1)); @@ -335,8 +328,7 @@ namespace lbson { write_binary(L); break; case bson_type::BSON_DATE: - write_date(L); - break; + case bson_type::BSON_INT64: case bson_type::BSON_TIMESTAMP: write_int64(L); break; @@ -499,7 +491,7 @@ namespace lbson { lua_pushinteger(L, read_val(L, slice)); break; case bson_type::BSON_DATE: - lua_pushinteger(L, read_val(L, slice) / 1000); + lua_pushinteger(L, read_val(L, slice)); break; case bson_type::BSON_INT64: case bson_type::BSON_TIMESTAMP: diff --git a/script/queue/mongo_mq.lua b/script/queue/mongo_mq.lua index 479d52cb..cb2aecd0 100644 --- a/script/queue/mongo_mq.lua +++ b/script/queue/mongo_mq.lua @@ -60,7 +60,7 @@ function MongoMQ:send_message(target_id, event, args, ttl) local doc = { args = args, event = event, target_id = target_id, time = quanta.now_ms, uuid = new_guid() } if ttl then --设置过期ttl字段 - doc.ttl = bdate(quanta.now + ttl) + doc.ttl = bdate(quanta.now_ms + ttl * 1000) end local ok = mongo_agent:insert({ self.coll_name, doc }, target_id) if not ok then