mirror of
https://github.com/btdig/dhtcrawler2.git
synced 2025-02-07 13:59:08 +00:00
fix daterange issure which not only record today torrents, not it only show the today inserted torrents
This commit is contained in:
parent
4dc05bf2cc
commit
ec456de63d
@ -35,8 +35,8 @@ insert(Conn, Hash, ReqCnt, UpSert) when is_list(Hash) ->
|
|||||||
DaySecs = time_util:now_day_seconds(),
|
DaySecs = time_util:now_day_seconds(),
|
||||||
BHash = list_to_binary(Hash),
|
BHash = list_to_binary(Hash),
|
||||||
% only record today new inserted torrent
|
% only record today new inserted torrent
|
||||||
Cmd = {findAndModify, ?COLLNAME, query, {'_id', BHash}, upsert, UpSert,
|
Cmd = {findAndModify, ?COLLNAME, query, {'_id', BHash, ?DATE_COL, DaySecs}, upsert, UpSert,
|
||||||
update, {'$inc', {reqs, ReqCnt}, '$set', {?DATE_COL, DaySecs}}, fields, {'_id', 1}},
|
update, {'$inc', {reqs, ReqCnt}}, fields, {'_id', 1}},
|
||||||
IRet = mongo:do(safe, master, Conn, ?DBNAME, fun() ->
|
IRet = mongo:do(safe, master, Conn, ?DBNAME, fun() ->
|
||||||
mongo:command(Cmd)
|
mongo:command(Cmd)
|
||||||
end),
|
end),
|
||||||
|
Loading…
Reference in New Issue
Block a user