Changeset 415


Ignore:
Timestamp:
11/16/11 10:16:47 (12 years ago)
Author:
nanardon
Message:
  • use numeric needupdate flag, then detect if another has been request
Location:
server/trunk/web
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/bin/sophie_scan

    r408 r415  
    1515 
    1616foreach my $pathkey (@pkey) { 
     17     
    1718    my $time = time; 
    18     Sophie::Scan::RpmsPath 
    19         ->new($pathkey, Sophie::Scan->new) 
    20         ->set_no_needupdate; 
    21     my @delta = Sophie::Scan::RpmsPath 
    22     ->new($pathkey, Sophie::Scan->new) 
    23     ->find_delta; 
     19    my $mark = 0; 
     20    my @delta; 
     21 
     22    { 
     23        my $path = Sophie::Scan::RpmsPath 
     24            ->new($pathkey, Sophie::Scan->new); 
     25        #$path->set_no_needupdate; 
     26 
     27        $mark = $path->get_needupdate; 
     28        @delta = $path->find_delta; 
     29    } 
     30 
    2431    while (my @d = splice(@delta, 0, 25)) { 
    2532        my $scan = Sophie::Scan->new; 
     
    2936    } 
    3037 
    31     Sophie::Scan::RpmsPath->new($pathkey, Sophie::Scan->new)->set_updated 
    32     if (!@delta); # update only if we finished 
     38    if (!@delta) { # update only if we finished 
     39        my $path = Sophie::Scan::RpmsPath->new($pathkey, Sophie::Scan->new); 
     40        $path->set_updated; 
     41        $path->set_no_needupdate 
     42            if ($mark ne $path->get_needupdate); 
     43    } 
    3344} 
    3445 
  • server/trunk/web/lib/Sophie/Controller/Admin/Update.pm

    r409 r415  
    1616 
    1717=cut 
    18  
    19 sub begin : Pivate {} 
    2018 
    2119sub paths :XMLRPC { 
     
    5250                    \[ " < now() - '24 hours'::interval" ], 
    5351                ], }, 
    54                 { needupdate => 'true' }, 
     52                { needupdate => scalar(time()) }, 
    5553            ] 
    5654        }, 
  • server/trunk/web/lib/Sophie/Controller/Login.pm

    r213 r415  
    3636                $c->stash->{xmlrpc} = 'sophie_session=' . $c->sessionid; 
    3737            } else { 
    38                 warn 'redirect'; 
    3938                $c->res->redirect($c->uri_for('/')); 
    4039            } 
  • server/trunk/web/lib/Sophie/Scan.pm

    r404 r415  
    3030                    \[ " < now() - '24 hours'::interval"], 
    3131                ], 
    32                 { needupdate => 'true', }, 
     32                { needupdate => { '>' => 0 }, }, 
    3333            ], 
    3434    })->get_column('d_path_key')->all 
  • server/trunk/web/lib/Sophie/Scan/RpmsPath.pm

    r408 r415  
    130130    $self->db->base->resultset('Paths')->find( 
    131131        { d_path_key => $self->key } 
    132     )->update({ needupdate => 'false' }); 
     132    )->update({ needupdate => 0 }); 
    133133    $self->db->commit; 
     134} 
     135 
     136sub get_needupdate { 
     137    my ($self) = @_; 
     138    $self->db->base->resultset('Paths')->find( 
     139        { d_path_key => $self->key } 
     140    )->get_column('needupdate'); 
    134141} 
    135142 
Note: See TracChangeset for help on using the changeset viewer.