working on optimizations

This commit is contained in:
Manuel Simon Hirsig
2016-03-17 17:27:50 +01:00
parent 795e277e3f
commit 26dd9ba6ae
3 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -197,7 +197,7 @@ local methods = {
GetRecordPercent = function(self, record)
if not record then return end
-- cache the market value on the record
record.historical_value = record.market_value or Aux.history.value(record.item_key) or 0
record.historical_value = record.historical_value or Aux.history.value(record.item_key) or 0
if record.historical_value > 0 then
if record.unit_buyout_price > 0 then
return Aux.round(100 * record.unit_buyout_price / record.historical_value, 1)
+20 -2
View File
@@ -4,7 +4,7 @@ Aux.history = public
function private.next_push()
local date = date('*t')
date.hour, date.min, date.sec = 24, 0, 0
return time()
return time(date)
end
function private.new_record()
@@ -17,6 +17,25 @@ function private.load_data()
return dataset.history
end
function public.test()
local data = private.load_data()
for key, _ in data do
local record = private.read_record(key)
record.next_push = 0
private.write_record(key, record)
end
end
function public.test2()
local data = private.load_data()
for key, _ in data do
data[key] = data[key]..'5000@5000'
for i=1,100 do
data[key] = data[key]..';9999@9995'
end
end
end
function private.read_record(item_key)
local data = private.load_data()
@@ -57,7 +76,6 @@ function private.write_record(item_key, record)
end
function public.process_auction(auction_record)
local item_record = private.read_record(auction_record.item_key)
local unit_bid_price = ceil(auction_record.bid_price / auction_record.aux_quantity)
+1 -1
View File
@@ -196,7 +196,7 @@ function private.scan_auctions_helper(i, n, k)
Aux.history.process_auction(auction_info)
if not private.current_query().validator or private.current_query().validator(auction_info) then
return private.wait_for_callback{private.current_thread().params.on_read_auction or Aux.util.pass, auction_info, recurse }
return private.wait_for_callback{private.current_thread().params.on_read_auction or Aux.util.pass, auction_info, recurse}
end
end