Changeset

9747:c8240f931a68

core.moduleapi: Move util imports to top
author Kim Alvefur <zash@zash.se>
date Sun, 30 Dec 2018 14:26:58 +0100
parents 9746:848fd204708c
children 9748:99199b53019f
files core/moduleapi.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Sun Dec 30 12:55:58 2018 +0000
+++ b/core/moduleapi.lua	Sun Dec 30 14:26:58 2018 +0100
@@ -14,6 +14,8 @@
 local timer = require "util.timer";
 local resolve_relative_path = require"util.paths".resolve_relative_path;
 local st = require "util.stanza";
+local cache = require "util.cache";
+local promise = require "util.promise";
 
 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
 local error, setmetatable, type = error, setmetatable, type;
@@ -364,14 +366,14 @@
 function api:send_iq(stanza, origin, timeout)
 	local iq_cache = self._iq_cache;
 	if not iq_cache then
-		iq_cache = require "util.cache".new(256, function (_, iq)
+		iq_cache = cache.new(256, function (_, iq)
 			iq.reject("evicted");
 			self:unhook(iq.result_event, iq.result_handler);
 			self:unhook(iq.error_event, iq.error_handler);
 		end);
 		self._iq_cache = iq_cache;
 	end
-	return require "util.promise".new(function (resolve, reject)
+	return promise.new(function (resolve, reject)
 		local event_type;
 		if stanza.attr.from == self.host then
 			event_type = "host";