というのを書いてみました。 といってもTheSchwartzのt/に入ってるdb-common.plからのほとんどコピペですが、 Pluginとか別パッケージで書く場合にあったほうが便利かなーとか思ったので。 こんなのいかが? 追記:codereposにいれてみました (http://coderepos.org/share/browser/lang/perl/TheSchwartz-Test) 追記:coderepos側のソースをみてもらえば十分なのでけしました
Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at
TheSchwartz の worker で、一つの job が worker->grab_for (default 3600) 秒以上掛かる処理をすると、処理中の job を他の worker が掴んでしまう。 具体的には大量のメール送信をしていたんだけど、Data::Valve でスロットリングしてゆっくり送っていたら 1時間以上掛かって、別の worker も同じ job を実行してしまった。結果、同じメールが 2通ずつ出た orz grab_for は job を処理しはじめた worker が、失敗を報告もできないでクラッシュした場合に、別の worker が処理できるようにするもの。しかし送信してしまったメールは取り消せないからな…… package MyWorker; use base qw/ TheSchwartz::Worker /; sub grab_for { 60
TheSchwartz の worker を Ctrl-C とか kill で止めた場合に、job の処理が半端な状態で終わられると困る、という話。以前 Deamon::Generic で TheSchwartz の worker をデーモン化する(2) - 酒日記 はてな支店 で諦めたんだけど、ちょっと必要に迫られたので考えてみたら一応できたっぽい。 package MyWorker; use strict; use warnings; use base qw( TheSchwartz::Worker ); sub sighandler { warn "caught signal @_\n"; no warnings 'redefine'; *TheSchwartz::work_once = sub { exit }; } sub work { my ($class, $job) = @
As Stated by Stack Overflow, anyway. Disagree? Vote now Sanitized… Showing you real Perl code has been deemed overly frightening Poll Developers actually dislike Perl, And jobs connected with Microsoft, at the very least one of people that exude their perspectives throughout Stack over flow. The city programming site provides developers ways to record their own technical affinities in their progra
TheSchwartzの概要は分かってきたので、実践投入に向けてより実用的なコードを書いてみます。TheSchwartz::Worker::SendEmailを使ってメールの配信というのが、簡単そう、かつ切実に必要なので、これを試してみました。 まず、PythonとTheSchwartzを媒介するGearmanベースのTheSchwartzを用意します。基本的には昨日言及したコードを利用し、データベースの設定だけ書き換えます。 # myschwartzd use Gearman::Worker; use TheSchwartz; use JSON::Any; my $j = JSON::Any->new; my $ts = TheSchwartz->new(databases => [{ dsn => "dbi:mysql:database=schwartz", user => "root
Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く