Skip to content

Instantly share code, notes, and snippets.

@2colours
Last active August 10, 2022 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2colours/255b578e65003f5c85b04ec21cd70bf9 to your computer and use it in GitHub Desktop.
Save 2colours/255b578e65003f5c85b04ec21cd70bf9 to your computer and use it in GitHub Desktop.
sub web-retrial(&actions, :$log-message) {
loop {
CATCH {
when X::Cro::HTTP::Error | X::Cro::HTTP::Client::Timeout {
say $log-message;
next;
}
}
return actions;
}
}
sub fetch-execution($execution-id) is cached {
web-retrial :log-message("$execution-id is being refetched..."), {
my $response = await $*client.get("https://some-jira-endpoint",
query => {
fields => 'some jira fields'
},
:$*auth,
:20timeout
);
await $response.body;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment