weechat-matrix-protocol-script icon indicating copy to clipboard operation
weechat-matrix-protocol-script copied to clipboard

Error reported with API

Open morpheusbeing opened this issue 9 years ago • 7 comments

After battling getting Lua5.3.3 and luarocks/jit operational, cjson and ffi installed, and matrix.lua wanting to operate from 5.1 folder, now working. I can log in using vector client. I have set username and password for olm.

Now getting: Call to API error in connect:https://matrix.org/_matrix/client/r0/login , maybe timeout?

Using Debian latest, updated but do have slow internet connection

Any hints please

morpheusbeing avatar Jul 17 '16 07:07 morpheusbeing

The problem seems to be my slow internet connection, logged in when on NBN fibre network, seems as if delay is needed to cope with slow networks

morpheusbeing avatar Jul 21 '16 10:07 morpheusbeing

It is definately related to internet connection speed. Now unable to connect, getting same error as first reported. Is it possible to modify that area of code to cope with low speed connections?

morpheusbeing avatar Jul 24 '16 10:07 morpheusbeing

got new satellite connection today, and still getting timeout error when trying to login. I haven't done speed test yet

morpheusbeing avatar Aug 09 '16 10:08 morpheusbeing

The problem is with expected timings of responses, currently set at 5, I changed out to 50 and it started working! I would humbly suggest that the timing variables be made local variables and be placed at top of script so can be easily found and changed as needed.

morpheusbeing avatar Aug 12 '16 05:08 morpheusbeing

I'd rather make them config variables so they can be accessed with /set

jansol avatar Aug 12 '16 07:08 jansol

@morpheusbeing can you send a PR with all the timers set higher? I would be fine with that, I would also tolerate a local variable at the top for shared value. I don't think /set should be necessary

torhve avatar Aug 12 '16 10:08 torhve

diff --git a/matrix.lua b/matrix.lua
index fe94dc0..cfc86a7 100644
--- a/matrix.lua
+++ b/matrix.lua
@@ -67,7 +67,7 @@ local DEBUG = false
 -- How many seconds to timeout if nothing happened on the server. If something
 -- happens before it will return sooner.
 -- default Nginx proxy timeout is 60s, so we go slightly lower
-local POLL_INTERVAL = 55
+local POLL_INTERVAL = 180

 local default_color = w.color('default')
 -- Cache error variables so we don't have to look them up for every error
@@ -1168,7 +1168,7 @@ function MatrixServer:initial_sync()
 local extra = 'initial'
 -- New v2 sync API is slow. Until we can easily ignore archived rooms
 -- let's increase the timer for the initial login
-    local login_timer = 60*5*1000
+    local login_timer = 60*20*1000
     http('/sync?'..data, nil, 'http_cb', login_timer, extra)
 end

The important one is the last 'initial'. I tried 5 to 50 first, which let is work but took long time for response, so dropped back to 20 and is still working OK for me

morpheusbeing avatar Aug 16 '16 00:08 morpheusbeing