Trigger randomly stopped executing HTTP calls

Post Reply
Screwbucket
Posts: 2
Joined: Tue Dec 06, 2022 6:13 pm

Trigger randomly stopped executing HTTP calls

Post by Screwbucket »

One of my triggers has suddenly seemingly topped functioning. The trigger executes just fine and debugging has shown that the perl matching is correct. However, once the HTTP is fired, nothing seems to happen. None of the debugc calls I make within the sysGetHttpDone handler are firing and no file is ever downloaded as it should be. Script is below. Any suggestions would be appreciated.
Code: [show] | [select all] lua
local saveFolder = "THIS IS THE SAVE FOLDER I HAVE REDACTED FOR PRIVACY"
local textToSelect = matches[1]
local post = textToSelect .. ".json"
local triggeredLineNumber = getLineNumber()
registerAnonymousEventHandler(
    "sysGetHttpDone",
    function(_, url, body)
      debugc("WE ARE HERE")
      if url == post then
        killAnonymousEventHandler(handlerId)
        local json = yajl.to_value(body)
        local link = json.post.file.url
        local explodedPath = Split(link, "/")
        local file = explodedPath[#explodedPath]
        if not io.exists(saveFolder .. file) then
          downloadFile(saveFolder .. file, link)
        end
        for i = triggeredLineNumber, triggeredLineNumber + 100, 1 do
          if not moveCursor(0, i) then
            break
          end
          if selectString(textToSelect, 1) >= 0 then
            debugc("SELECTED")
            break
          end
        end
        setUnderline(true)
        setLink([[showImagePreview("]] .. file .. [[")]], "Show Image Preview")
        resetFormat()
        moveCursorEnd()
      end
    end, true
  )
registerAnonymousEventHandler(
  'sysGetHttpError',
  function(event, response, rurl)
    if rurl == url then
      display(r)
    else
      return true
    end
  end,
  true
)
getHTTP(post)

Post Reply