diff --git a/lib/nylas.rb b/lib/nylas.rb index cc66c5a2..6575ed31 100644 --- a/lib/nylas.rb +++ b/lib/nylas.rb @@ -3,6 +3,21 @@ require "json" require "rest-client" +# BUGFIX +# See https://github.com/sparklemotion/http-cookie/issues/27 +# and https://github.com/sparklemotion/http-cookie/issues/6 +# +# CookieJar uses unsafe class caching for dynamically loading cookie jars +# If 2 rest-client instances are instantiated at the same time, (in threads) +# non-deterministic behaviour can occur whereby the Hash cookie jar isn't +# properly loaded and cached. +# Forcing an instantiation of the jar onload will force the CookieJar to load +# before the system has a chance to spawn any threads. +# Note this should technically be fixed in rest-client itself however that +# library appears to be stagnant so we're forced to fix it here +# This object should get GC'd as it's not referenced by anything +HTTP::CookieJar.new + require "ostruct" require "forwardable"