Bug #1261
closed
Hawat - Alerts - chybové hlášení cache (kešuje se prázdná hodnota)
Added by Jan Mach almost 11 years ago.
Updated over 10 years ago.
Category:
Development - GUI
Description
Při čisté instalaci je problém v tom, že simple-form se snaží načíst z cache položky pro svoje nabídky, ale tato cache se sama nevytvoří v případě, že neexistuje.
[error] Caught exception in Hawat::Controller::Alerts->list "Stored object must be given as first argument at /home/mek/Workspace/mentat/lib/Data/Cache/Folder.pm line 226, <DATA> line 1000.
Data::Cache::Folder::cache('Data::Cache::Folder=HASH(0x690d218)', 'alert-class-select', undef) called at /home/mek/Workspace/mentat/lib/Mentat/Storage/Mongo/Aggregator.pm line 230
Mentat::Storage::Mongo::Aggregator::get_alert_data('Mentat::Storage::Mongo::Aggregator=HASH(0x6903060)') called at /home/mek/Workspace/mentat/www/hawat/script/../lib/Hawat/Model/Alert.pm line 269
Hawat::Model::Alert::getSelectors('Hawat::Model::Alert=HASH(0x65b63b8)') called at /home/mek/Workspace/mentat/www/hawat/script/../lib/Hawat/Controller/Alerts.pm line 120
Hawat::Controller::Alerts::list('Hawat::Controller::Alerts=HASH(0x66912e0)', 'Hawat=HASH(0x68f9260)') called at /usr/share/perl5/Catalyst/Action.pm line 65
Oki, diky za nahlaseni.
Je to divne, protoze jsem to programoval tak, at se zepta, jestli klic existuje a pokud ne, at se jednoduse zavola prislusny dotaz.
Maku, prosim, dodej mi vice udaju, protoze kdyz smazu /var/mentat/cache a najedu na stranku alerts, tak se cache soubory vytvori..
root@mentat:/usr/local/mentat# ls -al /var/mentat/cache/
total 8
drwxrwxrwx 2 root root 4096 Oct 22 14:35 .
drwxr-xr-x 5 root root 4096 Sep 4 18:07 ..
root@mentat:/usr/local/mentat# ls -al /var/mentat/cache/
total 16
drwxrwxrwx 2 root root 4096 Oct 22 14:36 .
drwxr-xr-x 5 root root 4096 Sep 4 18:07 ..
-rw-r--r-- 1 www-data www-data 133 Oct 22 14:36 alert-class-select.bin
-rw-r--r-- 1 www-data www-data 65 Oct 22 14:36 alert-detector-select.bin
- Status changed from New to In Progress
Overit, ze se z mongo nejaka data vrati..
Osetrit situaci, kdy se Model pripadne snazi ulozit "nic" do cache.
Pravdepodobne je chyba zde (na porade se domluvime vice, jak to pripadne osetrit):
lib/Mentat/Storage/Mongo/Aggregator.pm
my $error = $self->{CACHE}->cache($key, $data);
# Report the error
if ($error)
{
Log::Loger->error(__PACKAGE__, "Cache error: $error");
die "$error\n";
}
- Status changed from In Progress to Resolved
Opraveno, sice ne jeste finalne, ale problemove misto ano. Vcetne osetreni databaze:
my $selector_data = [];
eval {
$selector_data = $self->{STORAGE}->aggregate($pipeline);
};
if ($@) {
my $message = "Unable call aggregate function of MongoDB: $@";
Log::Loger->error(__PACKAGE__, $message);
}
my @data = ();
foreach (@$selector_data)
{
push (@data, $_->{_id});
}
# return back
$result->{$key} = \@data;
# save cache
my $error = $self->{CACHE}->cache($key, \@data, $rewrite);
if ($error)
{
Log::Loger->error(__PACKAGE__, "Cache error: $error");
die "$error\n";
}
- Subject changed from Hawat - Alerts to Hawat - Alerts - chybové hlášení cache (kešuje se prázdná hodnota)
- Status changed from Resolved to Closed
Also available in: Atom
PDF