我想要mysql-proxy lua
脚本来处理对网站的交错访问(例如两个不同的浏览器窗口/用户),但能够暂停/延迟两者中的一个而不影响另一个。交错处理会话是可能的mysql-proyx lua
(所以似乎关于后者列出的输出),但是一旦我开始延迟脚本,它就会阻止所有内容,并且其他会话也无法推进。
-- the query which indicates the session/connection that shall be delayed at that execution
local qoi = "SELECT loginattempts,uid FROM mybb_users WHERE username='user1' LIMIT 1"
function read_query(packet)
if string.byte(packet) == proxy.COM_QUERY then
query = packet:sub(2)
start_time = os.time()
if query == qoi then
print("busy wait")
while os.time() < start_time + 20 do
--nothing
end
print("busy wait end")
end
print("Connection id: " .. proxy.connection.server.thread_id)
end
end
但是,此脚本以输出结束:
Connection id: 36
busy wait
busy wait end
Connection id: 36
Connection id: 36
Connection id: 36
Connection id: 37
Connection id: 37
Connection id: 36
Connection id: 36
Connection id: 36
Connection id: 37
而不是预期的
Connection id: 36
busy wait
connection id: 37
connection id: 37
busy wait end
Connection id: 36
我的意图甚至可以实现吗?如果可以,如何实现?