mirror of
https://github.com/btdig/dhtcrawler2.git
synced 2025-02-23 13:49:03 +00:00
change hash_date only record the new inserted torrents
This commit is contained in:
parent
76542be37a
commit
37ccb19575
@ -34,7 +34,8 @@ ensure_date_index(Conn) ->
|
|||||||
insert(Conn, Hash, ReqCnt) when is_list(Hash) ->
|
insert(Conn, Hash, ReqCnt) 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),
|
||||||
Cmd = {findAndModify, ?COLLNAME, query, {'_id', BHash}, upsert, true,
|
% only record today new inserted torrent
|
||||||
|
Cmd = {findAndModify, ?COLLNAME, query, {'_id', BHash}, % upsert, true,
|
||||||
update, {'$inc', {reqs, ReqCnt}, '$set', {?DATE_COL, DaySecs}}, fields, {'_id', 1}},
|
update, {'$inc', {reqs, ReqCnt}, '$set', {?DATE_COL, DaySecs}}, 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user