Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 41 lines (35 sloc) 1.223 kB
#!/usr/bin/perl
#
# bin/schedule-copier-jobs
#
# A simple job that schedules copier tasks for the sphinx copier. This should
# be run whenever you want to clean up the database of new/old data. Probably
# no more often than once every few weeks.
#
# Authors:
# Mark Smith <mark@dreamwidth.org>
#
# Copyright (c) 2009 by Dreamwidth Studios, LLC.
#
# This program is free software; you may redistribute it and/or modify it under
# the same terms as Perl itself. For a copy of the license, please reference
# 'perldoc perlartistic' or 'perldoc perlgpl'.
#
use strict;
use lib "$ENV{LJHOME}/extlib/lib/perl5";
use lib "$ENV{LJHOME}/cgi-bin";
BEGIN {
require 'ljlib.pl';
}
die "Need to have Sphinx search enabled.\n"
unless @LJ::SPHINX_SEARCHD;
my $dbr = LJ::get_db_reader() or die;
my $sth = $dbr->prepare( q{SELECT userid FROM user WHERE journaltype IN ('P','C')} );
$sth->execute;
my $sclient = LJ::theschwartz() or die;
while ( my ( $userid ) = $sth->fetchrow_array ) {
warn "Scheduling $userid ...\n";
$sclient->insert_jobs( TheSchwartz::Job->new_from_array( 'DW::Worker::Sphinx::Copier',
{ userid => $userid, source => "schedule" } ) );
select undef, undef, undef, 0.02;
}
Jump to Line
Something went wrong with that request. Please try again.