Sha256: 38c88bd4825b994c72fde3cf5198ee01f19380c8b1d57b0ec6bb45c3279ef019
Contents?: true
Size: 967 Bytes
Versions: 6
Compression:
Stored size: 967 Bytes
Contents
local hmset = function (key, dict) if next(dict) == nil then return nil end local bulk = {} for k, v in pairs(dict) do table.insert(bulk, k) table.insert(bulk, v) end return redis.call('HMSET', key, unpack(bulk)) end local payload = cjson.decode(redis.call('get', (KEYS[1]))) local ttl = payload.ttl local files_data = payload.files_data redis.call('DEL', KEYS[1]) for _, file_data in ipairs(files_data) do local hash_key = file_data.hash_key local first_updated_at = file_data.meta.first_updated_at file_data.meta.first_updated_at = nil hmset(hash_key, file_data.meta) redis.call('HSETNX', hash_key, 'first_updated_at', first_updated_at) for line, coverage in pairs(file_data.coverage) do redis.call("HINCRBY", hash_key, line, coverage) if coverage > 0 then redis.call("HSET", hash_key, line .. "_last_posted", ARGV[1]) end end if ttl and ttl ~= cjson.null then redis.call("EXPIRE", hash_key, ttl) end end
Version data entries
6 entries across 6 versions & 1 rubygems