NAME

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

VERSION

version 0.400

DESCRIPTION

This role provides sync_before and sync_after methods that wrap Git pull and push operations with retry logic. sync_before creates a App::karr::SyncGuard and retains it on the object as insurance: if the command body dies or croaks before sync_after runs, the guard's DESTROY pushes with 3 retries. Because the guard is held by the role (not by the caller), commands may call both methods in void context; sync_after neutralises the guard after a successful push so it never pushes twice.

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

METHODS

sync_before

$self->sync_before;

Pulls refs from remote with up to 3 attempts. Output is retry-only: the first attempt is silent, retries are announced from attempt 2 ("Pull retry 2 of 3..."), and errors always reach STDERR. --quiet additionally suppresses the retry announcements but never the errors. Creates a App::karr::SyncGuard, retains it on the object (so it outlives the call and covers the command body), and also returns it for callers that want to manage it explicitly. sync_after clears it on a successful push.

sync_after

$self->sync_after;  # push with up to 3 attempts

Pushes refs to remote with up to 3 attempts, using the same retry-only output convention as "sync_before" (silent first attempt, retries announced from attempt 2, errors always on STDERR, --quiet silencing only the announcements). After a successful push it marks the retained guard done and clears it so the guard's 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.