NAME

App::karr::Role::SyncLifecycle - Role providing sync lifecycle with retry and guard insurance

VERSION

version 0.205

DESCRIPTION

This role provides sync_before and sync_after methods that wrap Git pull and push operations with retry logic. sync_before returns a App::karr::SyncGuard object that acts as insurance: if the command body dies or croaks before sync_after is called, the guard's DESTROY runs sync_after with 3 retries.

Commands that compose this role must also have a store attribute (provided by App::karr::Role::BoardDiscovery) with a git accessor.

METHODS

sync_before

my $guard = $self->sync_before;

Pulls refs from remote with 3 retries and clear error messages on failure. Returns a App::karr::SyncGuard object. The guard must be marked done after successful sync_after, or it will attempt push on scope exit.

sync_after

$self->sync_after;  # push with 3 retries
$guard->done;       # mark guard as handled

Pushes refs to remote with 3 retries and clear error messages. After successful push, mark the guard done so its DESTROY is a no-op.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/karr/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.