mirror of
https://github.com/btdig/dhtcrawler2.git
synced 2025-01-18 20:21:37 +00:00
fix stats 1970 bug
This commit is contained in:
parent
53e3036f4f
commit
2f8842a18d
@ -61,11 +61,19 @@ stats() ->
|
||||
Conn = mongo_pool:get(?DB_POOLNAME),
|
||||
DaySecs = time_util:now_day_seconds(),
|
||||
TorSum = db_store_mongo:count(Conn),
|
||||
D1 = db_system:stats_day_at_slave(Conn, DaySecs),
|
||||
D2 = db_system:stats_day_at_slave(Conn, DaySecs - ?ONEDAY_SECS),
|
||||
D3 = db_system:stats_day_at_slave(Conn, DaySecs - 2 * ?ONEDAY_SECS),
|
||||
D1 = load_stats(Conn, DaySecs),
|
||||
D2 = load_stats(Conn, DaySecs - ?ONEDAY_SECS),
|
||||
D3 = load_stats(Conn, DaySecs - 2 * ?ONEDAY_SECS),
|
||||
{TorSum, [D1, D2, D3]}.
|
||||
|
||||
load_stats(Conn, DaySecs) ->
|
||||
case db_system:stats_day_at_slave(Conn, DaySecs) of
|
||||
{} ->
|
||||
{'_id', DaySecs};
|
||||
Doc ->
|
||||
Doc
|
||||
end.
|
||||
|
||||
% test only
|
||||
all_top() ->
|
||||
Conn = mongo_pool:get(?DB_POOLNAME),
|
||||
|
Loading…
Reference in New Issue
Block a user