refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-27 12:47:29 +02:00
parent abcc782daa
commit b734d14bea
12 changed files with 86 additions and 121 deletions
+12 -12
View File
@@ -5,30 +5,30 @@ local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='
value_cache = t
do
local data
function property.data.get()
if not data then
local cache
function data.get()
if not cache then
local dataset = persistence.dataset
data = dataset.history or t
dataset.history = data
cache = dataset.history or t
dataset.history = cache
end
return data
return cache
end
end
do
local next_push = 0
function property.next_push.get()
if time() > next_push then
local time = 0
function next_push.get()
if time() > time then
local date = date '*t'
date.hour, date.min, date.sec = 24, 0, 0
next_push = time(date)
time = time(date)
end
return next_push
return time
end
end
function property.new_record.get()
function new_record.get()
return -object('next_push', next_push, 'data_points', t)
end
+2 -2
View File
@@ -37,13 +37,13 @@ do
call(on_complete)
end
function property.state.get()
function state.get()
local _, state = next(filter(scan_states, function(state) return state.id == thread_id end))
return state
end
end
function property.query.get() return state.params.queries[state.query_index] end
function query.get() return state.params.queries[state.query_index] end
function wait_for_callback(...) temp=arg
local send_signal, signal_received = signal()