How are we supposed to do distribution of reward for a tournament?

Below is a how i am distributing rewards on tournament end

local function distribute_tournament_reward(ctx, tournament, session_end, expiry)
	nk.logger_info("Tournament: " .. nk.json_encode(tournament))
	nk.logger_info("Id: " .. tournament.id)
	nk.logger_info("Expiry: " .. nk.json_encode(expiry))

	local notifications = {}
	local records, owner_records, nc, pc = nk.leaderboard_records_list(tournament.id, nil, 10, nil, expiry)
	local reward = nk.storage_read({{
		collection = "tournament_reward",
		key = "reward"
	}})

	nk.logger_info("Reward: " .. nk.json_encode(reward))
	nk.logger_info("---- Distributing Rewards ----")
	nk.logger_info("Recrods: " .. #records)

	local rewardTable = reward[1]

	for i = 1, #records do
		local rewardContent = {}

		if(records[i].rank == 1) then
			rewardContent["gold"] = rewardTable.value.rank1
		elseif(records[i].rank == 2) then
			rewardContent["gold"] = rewardTable.value.rank2
		elseif(records[i].rank == 3) then
			rewardContent["gold"] = rewardTable.value.rank3
		else
			rewardContent["gold"] = rewardTable.value.other
		end

		nk.logger_info("Sending Reward To: " .. records[i].owner_id)

		notifications[i] = {
		  code = 1,
		  content = nk.json_encode(rewardContent),
		  persistent = true,
		  subject = "Reward for Tournament",
		  user_id = records[i].owner_id
		}
	end

	nk.notifications_send(notifications)
end

I have had set up a tournament with runtime-code.

local nk = require("nakama")

local function set_up_animal_kingdom_tournament(name)
	local id = name
	local authoritative = false
	local sort = "desc"     -- One of: "desc", "asc".
	local operator = "incr" -- One of: "best", "set", "incr".
	local reset = "*/10 * * * *" -- Every 10 minutes

	title = "Animal Kingdom"
	description = "Earn the most money!"
	category = 1
	start_time = os.time{year=2020, month=1, day=1, hour=1, min=0, sec= 0} -- Start now.
	end_time = 0         -- Never end, repeat the tournament each day forever.
	duration = 300      -- In seconds.
	max_size = 10000     -- First 10,000 players who join.
	max_num_score = 1000    -- Each player can have 3 attempts to score.
	join_required = false -- Must join to compete.

	nk.tournament_create(id, sort, operator, duration, reset, metadata, title, description,
		category, start_time, endTime, max_size, max_num_score, join_required)
end

local function set_up_animal_leaderboard()
	local id = "money_makers"
	local authoritative = true
	local sort = "desc"     -- One of: "desc", "asc".
	local operator = "set" -- One of: "best", "set", "incr".

	nk.leaderboard_create(id, authoritative, sort, operator, nil, nil)
end

nk.run_once(function()
	set_up_animal_kingdom_tournament("animal_kingdom")
	set_up_animal_leaderboard()
end)

My question is, it seems with the expiry in the nk.leaderboard_records_list(tournament.id, nil, 10, nil, expiry), it will cause the record to always be return 0 records, because its taking the expiry of the first tournament end time.

Am i wrong or is is not necessary to put the expiry in there since the tournament always reset its records?

Looking at the parameter for leaderboard_records_list from here https://github.com/heroiclabs/nakama/blob/af3073ff3c66db726ab252ee59f1617341e142d0/server/runtime_lua_nakama.go#L4890

cursor and expiry is optional

In theory calling it like this should work

nk.leaderboard_records_list(tournament.id, nil, 10)