Skip to content

Commit

Permalink
trying to fix issue #19 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
jckleiner authored Sep 12, 2024
1 parent 1c1febf commit 47baf4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/greydev/notionbackup/NotionClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private Optional<String> getDownloadLink(String taskId) throws IOException, Inte
.uri(URI.create(GET_TASKS_ENDPOINT))
.header("Cookie", TOKEN_V2 + "=" + notionTokenV2)
.header("Content-Type", "application/json")
.timeout(Duration.ofSeconds(10))
.timeout(Duration.ofSeconds(20))
.POST(HttpRequest.BodyPublishers.ofString(postBody))
.build();

Expand All @@ -210,12 +210,12 @@ private Optional<String> getDownloadLink(String taskId) throws IOException, Inte

Results results = objectMapper.readValue(response.body(), Results.class);

if (results.getResults().isEmpty()) {
if (results == null || results.getResults() == null || results.getResults().isEmpty()) {
sleep(6000);
continue;
}

Result result = results.getResults().stream().findFirst().get();
Result result = results.getResults().get(0);

if (result.isFailure()) {
log.info("Notion API workspace export returned a 'failure' state. Reason: {}", result.getError());
Expand Down

0 comments on commit 47baf4d

Please sign in to comment.