Something went wrong. Try again.
Perl game server for TLE Community
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172package Lacuna;
use strict;use Module::Find qw(useall);use Lacuna::DB;use Config::JSON;
useall __PACKAGE__;
our $VERSION = 4.0008;
my $config = Config::JSON->new('/home/lacuna/server/etc/lacuna.conf');
# AutoInactiveDestroy: Starman runs with --preload-app, so this connect() call# happens once in the master process before it forks into workers -- every# worker inherits a copy of this same underlying socket. Without this flag,# a forked worker's own DESTROY (worker recycle/exit) sends a real disconnect# down that *shared* socket, pulling it out from under sibling workers still# using it. DBIx::Class::Storage::DBI already does PID-checked reconnect for# preforking servers; this is the one flag it needs to do so safely. Don't add# mysql_auto_reconnect here -- it fights with DBIC's own reconnect/retry logic.my $db = Lacuna::DB->connect( $config->get('db/dsn'), $config->get('db/username'), $config->get('db/password'), { mysql_enable_utf8 => 1, AutoInactiveDestroy => 1 });
my $cache = Lacuna::Cache->new(servers => $config->get('memcached'));my $queue;
if ($config->get('beanstalk')) { $queue = Lacuna::Queue->new({ server => $config->get('beanstalk/server'), ttr => $config->get('beanstalk/ttr'), debug => $config->get('beanstalk/debug'), });}
sub version { return $VERSION;}
sub config { return $config;}
sub db { return $db;}
sub cache { return $cache;}
sub queue { return $queue;}
# True only in the local dev docker-compose stack (LACUNA_HIGH_SPEED_TEST_MODE# is set in docker-compose.yml's server service, and deliberately never# set in docker-compose.deployed.yml). Collapses build/travel/work timers to# near-instant for manual testing; never changes random-chance odds.sub high_speed_test_mode { return $ENV{'LACUNA_HIGH_SPEED_TEST_MODE'} ? 1 : 0;}
1;