zuora_connect 3.1.1.pre.b → 3.1.1.pre.c

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dd5e2ff6670df441c2724f6aeabea79b29ee265c7bea135041a9373702c51d6
4
- data.tar.gz: 922c6b8010adfc8b6cf0e90f734ff71830cde9d54e864ff548ea4dfc6074be4a
3
+ metadata.gz: ef73a28bd87609cedef16023f75320765d7b38b3e3417be5b5000be410596127
4
+ data.tar.gz: 62440f4e6e5ae219f40d9dc5b927b896cd26214cb9693191629929594c9f349a
5
5
  SHA512:
6
- metadata.gz: 32052d8b5ffe9ab9d059012c90073d23eff3d21cd79b01db9cfe7e861899b354053e044d62675cde97161b7b16305f3980bb6e47c1a9d430dbf2b7eb6882d478
7
- data.tar.gz: a8f6926fc4090116cc19034b7390807e0283d185aa033ffcf190d8fd922c470a4fafed645beed473c7a051757a986f21d13bb92a760f9f7efe77f1ab6b402ed2
6
+ metadata.gz: fe0dc6bf317c0ff0e76d069db2abd158175527cd5b971065b6c84d79412971c4fbab8ad5141bd4525497d41e38ca2b99c0760f662791a920955770692e278ef5
7
+ data.tar.gz: f15d374ed1aaa037ca1764d71f468eac6019b6515ac0a41f20835e732adc0dc9651b893f8f5f18b2a494e2e54f083be7dda77b9a6863dbd53a1d39f13e7cb221
@@ -43,7 +43,6 @@ module ZuoraConnect
43
43
 
44
44
  def cache_bust
45
45
  if defined?(Redis.current)
46
- @appinstance.reload
47
46
  @appinstance.fetch_connect_data #Fetch data and set in database if kms key is used
48
47
  @appinstance.cache_app_instance(force_cache: true) #Update cache in redis
49
48
  Redis.current.del("AppInstance:#{@appinstance.id}")
@@ -353,6 +353,7 @@ module ZuoraConnect
353
353
  end
354
354
 
355
355
  def fetch_connect_data(session: {})
356
+ refresh_count ||= 0
356
357
  self.check_oauth_state
357
358
  request_url = ZuoraConnect.configuration.url + "/api/#{self.api_version}/tools/tasks/#{self.id}.json"
358
359
  response = HTTParty.get(request_url,:body => {:access_token => self.access_token})
@@ -370,43 +371,41 @@ module ZuoraConnect
370
371
  else
371
372
  raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error communicating with Connect for '#{request_url}' with #{response.code}", response.body, response.code)
372
373
  end
374
+ rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
375
+ refresh_count += 1
376
+ if refresh_count < 3
377
+ sleep(10)
378
+ ZuoraConnect.logger.debug("REFRESH TASK - Connection Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
379
+ retry
380
+ else
381
+ ZuoraConnect.logger.fatal("REFRESH TASK - Connection Failed", ex)
382
+ raise
383
+ end
384
+ rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
385
+ refresh_count += 1
386
+ if refresh_count < 3
387
+ ZuoraConnect.logger.debug("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
388
+ self.refresh_oauth if ex.code == 401
389
+ retry
390
+ else
391
+ ZuoraConnect.logger.fatal("REFRESH TASK - Communication Failed #{ex.code}", ex, self.default_ougai_items)
392
+ raise
393
+ end
373
394
  end
374
395
 
375
-
376
396
  def refresh(session: {})
377
397
  refresh_count ||= 0
378
398
  skip_connect ||= ZuoraConnect.configuration.skip_connect
379
- begin
380
- #Check how app was deployed
381
- if !self.auto_deployed? && (!skip_connect || self['zuora_logins'].blank?)
382
- self.fetch_connect_data(session: session)
383
- else
384
- self.build_task(task_data: self.zuora_logins, session: session)
385
- end
386
- self.last_refresh = Time.now.to_i
387
- self.cache_app_instance
388
- self.reset_mark_for_refresh
389
- rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
390
- refresh_count += 1
391
- if refresh_count < 3
392
- sleep(10)
393
- ZuoraConnect.logger.debug("REFRESH TASK - Connection Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
394
- retry
395
- else
396
- ZuoraConnect.logger.fatal("REFRESH TASK - Connection Failed", ex)
397
- raise
398
- end
399
- rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
400
- refresh_count += 1
401
- if refresh_count < 3
402
- ZuoraConnect.logger.debug("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
403
- self.refresh_oauth if ex.code == 401
404
- retry
405
- else
406
- ZuoraConnect.logger.fatal("REFRESH TASK - Communication Failed #{ex.code}", ex, self.default_ougai_items)
407
- raise
408
- end
399
+ #Check how app was deployed
400
+ if !self.auto_deployed? && (!skip_connect || self['zuora_logins'].blank?)
401
+ self.fetch_connect_data(session: session)
402
+ else
403
+ self.build_task(task_data: self.zuora_logins, session: session)
409
404
  end
405
+ self.last_refresh = Time.now.to_i
406
+ self.cache_app_instance
407
+ self.reset_mark_for_refresh
408
+
410
409
  rescue => ex
411
410
  refresh_count += 1
412
411
  if self['zuora_logins'].present? && refresh_count < 3
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.1.1-b"
4
+ VERSION = "3.1.1-c"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1.pre.b
4
+ version: 3.1.1.pre.c
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2022-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment