~singpolyma/jmp-pay

c5130f36d5024d00dd2615de7f12fc5de2339c72 — Stephen Paul Weber 1 year, 3 months ago e29daf4
Exit after an error in EM
1 files changed, 6 insertions(+), 1 deletions(-)

M lib/blather_notify.rb
M lib/blather_notify.rb => lib/blather_notify.rb +6 -1
@@ 14,7 14,8 @@ module BlatherNotify
		# workqueue_count MUST be 0 or else Blather uses threads!
		setup(jid, password, nil, nil, nil, nil, workqueue_count: 0)

		EM.error_handler { |e| warn e.message }
		EM.error_handler(&method(:panic))

		@thread = Thread.new do
			EM.run do
				client.run


@@ 23,7 24,11 @@ module BlatherNotify

		Timeout.timeout(30) { @ready.pop }
		at_exit { wait_then_exit }
	end

	def self.panic(e)
		warn e.message
		exit 2
	end

	def self.wait_then_exit