Closed dgw closed 9 years ago
Are those all small vars or large ones? Small ones are always kept in memory, so it's not a matter of refilling the cache so much as stopping it from getting corrupt.
$noun
has over 1300 values at present. $adjective
only has around 240. So it seems to be a cache-refill issue indeed.
Preliminary testing shows I might have fixed this with the simplest, dumbest little change in &expand()
. Assuming the issue remains fixed in testing over the next few days, I'll be opening a PR with the fix.
Currently, it's using a hardcoded minimum number of values, but I might change it to use the value of var_limit
to make sure the cache for each var always has enough values to fully replace a factoid containing the maximum number of variable references even if every single var is the same one.
This is a long log, but it shows what happens with the potential fix in place:
Thu Oct 22 17:46:16 2015 - irc_public(#Kaede): dgw(o=1, a=0, e=1): !tales
RESULT:
$VAR1 = {
'tidbit' => 'Tales of $Nouns: $Noun of the $Adjective $Noun',
'verb' => '<reply>',
'fact' => '!tales',
'id' => '2195'
};
BAGGAGE:
$VAR1 = {
'msg' => '!tales',
'rc' => {
'plugin' => 0
},
'cmd' => 'fact',
'addressed' => 0,
'to' => undef,
'who' => 'dgw',
'chl' => '#Kaede',
'editable' => 1,
'type' => 'irc_public',
'orig' => '!tales',
'op' => 1
};
PLACEHOLDERS:
$VAR1 = [
'!tales'
];
Thu Oct 22 17:46:16 2015 - Found variable $Nouns
Thu Oct 22 17:46:16 2015 - Special case *s (noun)
Thu Oct 22 17:46:16 2015 - full = Nouns, msg = Tales of $Nouns: $Noun of the $Adjective $Noun
Thu Oct 22 17:46:16 2015 - Conjugating interrobang (CODE(0x1979b20))
Thu Oct 22 17:46:16 2015 - past=CODE(0x18a3540), s_form=CODE(0x1b1e278), gerund=CODE(0x18a3630)
Thu Oct 22 17:46:16 2015 - => interrobangs
Thu Oct 22 17:46:16 2015 - Replacing $Nouns with Interrobangs
Thu Oct 22 17:46:16 2015 - => Tales of Interrobangs: $Noun of the $Adjective $Noun
Thu Oct 22 17:46:16 2015 - Found variable $Noun
Thu Oct 22 17:46:16 2015 - full = Noun, msg = Tales of Interrobangs: $Noun of the $Adjective $Noun
Thu Oct 22 17:46:16 2015 - Replacing $Noun with Series
Thu Oct 22 17:46:16 2015 - Refilling cache for Noun
Thu Oct 22 17:46:16 2015 - Replacing $Noun with Baseball Bat
Thu Oct 22 17:46:16 2015 - => Tales of Interrobangs: Series of the $Adjective Baseball Bat
Thu Oct 22 17:46:16 2015 - Found variable $Adjective
Thu Oct 22 17:46:16 2015 - full = Adjective, msg = Tales of Interrobangs: Series of the $Adjective Baseball Bat
Thu Oct 22 17:46:16 2015 - Replacing $Adjective with Princely
Thu Oct 22 17:46:16 2015 - => Tales of Interrobangs: Series of the Princely Baseball Bat
Use of uninitialized value in pattern match (m//) at (eval 118) line 52.
RESULT:
$VAR1 = [
{
'value' => 'manta ray',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'cloud',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'Necronomicon',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'kidney stone',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'brioche',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'constellation',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'mechanical keyboard',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'hard drive',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'table',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'toothbrush',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'file',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'cur',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'cathode ray tube',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'orb',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'dick',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'noose',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'combination fort',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'comic strip',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'parka',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
},
{
'value' => 'Walkman',
'name' => 'noun',
'type' => 'noun',
'id' => '902',
'perms' => 'read-only'
}
];
BAGGAGE:
$VAR1 = {
'cmd' => 'load_vars_large'
};
PLACEHOLDERS:
$VAR1 = [
'Noun'
];
Thu Oct 22 17:46:16 2015 - Loading large replacables: noun
Probably trigger a refill if remaining value count is less than
&config("var_limit")
. Things like this wouldn't happen then.