The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Dancer2::Plugin::Shutdown::Redis - Graceful shutdown your Dancer2 application with Redis propagation

VERSION

version 0.002

SYNOPSIS

    use Dancer2;
    use Dancer2::Plugin::Redis;
    use Dancer2::Plugin::Shutdown;
    
    shutdown_redis(redis_plugin(), 'my_shutdown_key');
    
    $SIG{HUP} = sub {
        # on hangup, shutdown in 120 seconds
        shutdown_at(120);
    };

DESCRIPTION

This module is based on Dancer2::Plugin::Shutdown so see there for an introduction.

The difference is the way the shutdown is propagated in multi-instance setups like Starman or Corona. The state is stored in a shared variable, tied with Tie::Redis::Candy to a Redis key. On every request this Redis key is checked so every instance get the very latest state.

One instance call "shutdown_at", all instances react by gracefully shutdown your application.

FUNCTIONS

shutdown_at

See "shutdown_at" in Dancer2::Plugin::Shutdown

shutdown_session_validator

See "shutdown_session_validator" in Dancer2::Plugin::Shutdown

shutdown_redis

Invokation: shutdown_redis( $redis, $key )

Set the instance of Redis and the correspondig key. Both arguments are mandatory.

Hint: the author recommends Dancer2::Plugin::Redis.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/zurborg/libdancer2-plugin-shutdown-redis-perl/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

David Zurborg <zurborg@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by David Zurborg.

This is free software, licensed under:

  The ISC License