- Setze HTTP-Timeout korrekt

- convert_timestamp nutzt nun os.date()
This commit is contained in:
Andreas Bielawski 2016-09-08 00:28:20 +02:00
parent db120805ac
commit c37ad5a156
3 changed files with 5 additions and 8 deletions

View File

@ -23,7 +23,7 @@
local bindings = {}
local https = require('ssl.https')
https.timeout = 10
https.TIMEOUT = 10
local json = require('dkjson')
local ltn12 = require('ltn12')
local mp_encode = require('multipart-post').encode

View File

@ -62,7 +62,6 @@ end
function bot:on_msg_receive(msg, config) -- The fn run whenever a message is received.
-- remove comment to enable debugging
-- vardump(msg)
-- Cache user info for those involved.
if msg.date < os.time() - 5 then return end -- Do not process old messages.

View File

@ -34,8 +34,8 @@ mime = (loadfile "./otouto/mimetype.lua")()
OAuth = require "OAuth"
helpers = require "OAuth.helpers"
http.timeout = 5
https.timeout = 5
http.TIMEOUT = 7
https.TIMEOUT = 7
-- For the sake of ease to new contributors and familiarity to old contributors,
-- we'll provide a couple of aliases to real bindings here.
@ -387,10 +387,8 @@ function run_command(str)
return result
end
function convert_timestamp(timestamp, format)
local converted_date = run_command('date -d @'..timestamp..' +"'..format..'"')
local converted_date = string.gsub(converted_date, '%\n', '')
return converted_date
function convert_timestamp(timestamp, date_format)
return os.date(date_format, timestamp)
end
function string.starts(String, Start)