embulk-input-facebook_ads_insights 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d46e96da39a17161b5c84ce1e0f47b984d170311
4
- data.tar.gz: 5e3558265b4c7201478eb70ab96bcc5ecfc8f467
3
+ metadata.gz: 606a76b2a27dc98a9e07eacf7dd2c992c328eba0
4
+ data.tar.gz: acdf8402bfd404a55f59684e675b9e2ef95ad41f
5
5
  SHA512:
6
- metadata.gz: fe9dca2e749a6f6f94adb57aaf1d788663e10a4c3a31ee9323452c6d2628f846cc212b3f8de96ee0916e7f8c463e8ea91f13f6e2e1d6433df9d21056ae46cee7
7
- data.tar.gz: 83f87b360a4949455f323e9d949790c0a45077bb37ac70977db477343b9b78fec9ac528d97df328091f0341e23bdd31bccf48c2a595e7840b7e8a4bb2f06dc4c
6
+ metadata.gz: 70875282b4fb53bfc43e6c2dfdd5735171dbae30d6beadba8e09c878182635856a56d90644248c710e40657fb5c5fed138eb5dea563b65ceaa81ada49e1ce4f8
7
+ data.tar.gz: 343161efcb979f9abc5570c9cbb0a79b360edcea98b6bc5ef858938083a24fe8b2ce1b1f4560da959eea594d2ddb03cbcf5a2341d529ce4f3028daf7017ec4c0
@@ -13,7 +13,7 @@ configurations {
13
13
  provided
14
14
  }
15
15
 
16
- version = "0.1.3"
16
+ version = "0.1.4"
17
17
 
18
18
  sourceCompatibility = 1.8
19
19
  targetCompatibility = 1.8
@@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
18
18
 
19
19
  import java.util.ArrayList;
20
20
  import java.util.List;
21
+ import java.util.Objects;
21
22
  import java.util.stream.Collectors;
22
23
 
23
24
  public class Client
@@ -57,7 +58,23 @@ public class Client
57
58
  while (adReportRun.fetch().getFieldAsyncPercentCompletion() != 100) {
58
59
  Thread.sleep(ASYNC_SLEEP_TIME);
59
60
  }
60
- APINodeList<AdsInsights> adsInsights = adReportRun.getInsights().execute();
61
+ // extra waiting
62
+ int retryCount = 0;
63
+ boolean succeeded = false;
64
+ APINodeList<AdsInsights> adsInsights = null;
65
+ while (retryCount < pluginTask.getMaxWeightSeconds() && !succeeded) {
66
+ try {
67
+ Thread.sleep(1000);
68
+ adsInsights = adReportRun.getInsights().execute();
69
+ succeeded = true;
70
+ }
71
+ catch (APIException e) {
72
+ retryCount++;
73
+ }
74
+ }
75
+ if (Objects.isNull(adsInsights)) {
76
+ throw new APIException();
77
+ }
61
78
  return isPaginationValid ? fetchAllPage(adsInsights) : adsInsights;
62
79
  }
63
80
 
@@ -81,4 +81,8 @@ public interface PluginTask extends Task
81
81
  @Config("use_account_attribution_setting")
82
82
  @ConfigDefault("null")
83
83
  public Optional<Boolean> getUseAccountAttributionSetting();
84
+
85
+ @Config("max_wait_seconds")
86
+ @ConfigDefault("60")
87
+ public Integer getMaxWeightSeconds();
84
88
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-facebook_ads_insights
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - naotaka nakane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-15 00:00:00.000000000 Z
11
+ date: 2020-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ files:
50
50
  - README.md
51
51
  - build.gradle
52
52
  - classpath/annotations-13.0.jar
53
- - classpath/embulk-input-facebook_ads_insights-0.1.3.jar
53
+ - classpath/embulk-input-facebook_ads_insights-0.1.4.jar
54
54
  - classpath/facebook-java-business-sdk-4.0.5.jar
55
55
  - classpath/gson-2.5.jar
56
56
  - classpath/guava-20.0.jar