unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/1] msgmap: ignore duplicates instead of dying
Date: Fri, 23 Jun 2017 01:21:34 +0000	[thread overview]
Message-ID: <20170623012134.GA15329@dcvr> (raw)
In-Reply-To: <20170622220117.7252-1-e@80x24.org>

This prevents public-inbox-watch from dying when reloading
(and thus rescanning) already-imported directories.
---
 lib/PublicInbox/Msgmap.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index a49b61e..7e0f34a 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -179,7 +179,7 @@ sub id_batch {
 sub mid_set {
 	my ($self, $num, $mid) = @_;
 	my $sth = $self->{mid_set} ||= do {
-		my $sql = 'INSERT INTO msgmap (num, mid) VALUES (?,?)';
+		my $sql = 'INSERT OR IGNORE INTO msgmap (num, mid) VALUES (?,?)';
 		$self->{dbh}->prepare($sql);
 	};
 	$sth->execute($num, $mid);
-- 
EW

      reply	other threads:[~2017-06-23  1:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 22:01 [PATCH] msgmap: mid_insert ignores duplicates instead of die-ing Eric Wong
2017-06-23  1:21 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170623012134.GA15329@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).