Project

General

Profile

Actions

Bug #1261

closed

Hawat - Alerts - chybové hlášení cache (kešuje se prázdná hodnota)

Added by Jan Mach about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Development - GUI
Target version:
Start date:
10/22/2013
Due date:
% Done:

0%

Estimated time:
To be discussed:

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
Actions #1

Updated by Radomír Orkáč about 11 years ago

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
Actions #2

Updated by Radomír Orkáč about 11 years ago

  • 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.

Actions #3

Updated by Radomír Orkáč about 11 years ago

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";
        }

Actions #4

Updated by Radomír Orkáč about 11 years ago

  • 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";
            }  

Actions #5

Updated by Pavel Kácha almost 11 years ago

  • Subject changed from Hawat - Alerts to Hawat - Alerts - chybové hlášení cache (kešuje se prázdná hodnota)
Actions #6

Updated by Radomír Orkáč almost 11 years ago

Upraveno finalne.

Actions #7

Updated by Pavel Kácha almost 11 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF