Skip to content

Commit

Permalink
Fix LOADING redis check being bypassed by settings migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed May 29, 2023
1 parent aaf17b4 commit f9b7651
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/LANraragi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,11 @@ sub startup {
die;
}

# Check old settings and migrate them if needed
if ( $self->LRR_CONF->get_redis->keys('LRR_*') ) {
say "Migrating old settings to new format...";
migrate_old_settings($self);
}

my $devmode;

# Catch Redis errors on our first connection. This is useful in case of temporary LOADING errors,
# Where Redis lets us send commands but doesn't necessarily reply to them properly.
# (https://github.com/redis/redis/issues/4624)
while (1) {
eval { $devmode = $self->LRR_CONF->enable_devmode; };
eval { $self->LRR_CONF->get_redis->keys('*') };

last unless ($@);

Expand All @@ -91,7 +83,13 @@ sub startup {
sleep 2;
}

if ($devmode) {
# Check old settings and migrate them if needed
if ( $self->LRR_CONF->get_redis->keys('LRR_*') ) {
say "Migrating old settings to new format...";
migrate_old_settings($self);
}

if ( $self->LRR_CONF->enable_devmode ) {
$self->mode('development');
$self->LRR_LOGGER->info("LANraragi $version (re-)started. (Debug Mode)");

Expand Down

0 comments on commit f9b7651

Please sign in to comment.