Fixed Rate Client Post, not timing out

I'm using some API calls, in a fixed rate timer script. In my script I've configured quite a short time out, but the script seems to get stuck at the API call and then just seems to be aborted when that fixed rate times out.
I don't mind if it time out as the idea is we should put this into a retry queue, but as it just aborts it doesn't failover and retry continue the script. Is there a way to force the client to give up after the timeout and then we continue.
My timer script is as below:
We pass an object containing the data, url, method etc. into the queue it polls from.

client =

def alarmQueueTimerScript():
	logger.debug("Sending Alarm Transmisson Start")
	nextItem = alarmDeque.poll(5000, TimeUnit.MILLISECONDS)"Alarm Queue, next item: " + str(nextItem))
	if nextItem:
		if nextItem["method"] == "post":
				response =["url"], data=nextItem["data"], headers=nextItem["headers"])
			except Exception as e:
				logger.error("Fail to send alarm data! Appending to retry queue...")
				logger.debug("Fail to send: {a}, to URL: {b}".format(a = str(data), b = str(url)))
				logger.trace("Fail to send because of {a}".format(a = str(e)))

Whenever it gets to the line about it halts there and doesn't continue any further, my loop is at a fixed rate of 5000 ms, I'm expecting it to give up before then and continue the function, but it never does.

I'm testing without connection to the end point to test the failure conditions.

Timer events in Ignition do not enforce their periods--only one instance will run at a time. You have two timeouts--one in the .poll() operation, and one in the httpClient(). If you are running the event steadily, you should not have a poll timeout. Simply poll, and if there's nothing to do, let the timer call you again in a few seconds.

Second, this construct:

	... do something ...
except Exception as e:
	... handle it ...

Will only catch jython exceptions, not java exceptions. Jython's Exception is not in the same class hierarchy as java's Exception. Use something like this:

	... do something ...
except Exception as e:
	... handle jython exception ...
except Throwable as t:
	... handle java exception or error ...

When you have java throwables (or any subclass), you can use the logger methods that accept such as the final argument to get nice tracebacks in your logs. You should not be stringifying exceptions.

When you have a jython exception that you want to log, consider using my PythonAsJavaException class from to wrap it in a throwable that is acceptable to the logging infrastructure.