ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: Use the thread name instead of the number
Date Mon, 21 Nov 2016 18:46:09 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 37c06413c -> fc2a07975


Use the thread name instead of the number

If there is a stack trace, it will include the thread name

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/fc2a0797
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/fc2a0797
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/fc2a0797

Branch: refs/heads/master
Commit: fc2a0797523570a4211b66bec5905f1c1c4e7afd
Parents: 37c0641
Author: Sebb <sebb@apache.org>
Authored: Mon Nov 21 18:46:00 2016 +0000
Committer: Sebb <sebb@apache.org>
Committed: Mon Nov 21 18:46:00 2016 +0000

----------------------------------------------------------------------
 tools/import-mbox.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/fc2a0797/tools/import-mbox.py
----------------------------------------------------------------------
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index dcddfe6..ad8a770 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -141,15 +141,12 @@ class BulkThread(Thread):
 
 class SlurpThread(Thread):
 
-    def __init__(self, index):
-        self.id = index
-        super(SlurpThread, self).__init__()
-
-    def printid(self,message):
-        print("%d: %s" % (self.id, message))
+    def printid(self, message):
+        print("%s: %s" % (self.name, message))
 
     def run(self):
         global block, y, es, lists, baddies, config, resendTo, timeout, dedupped, dedup
+        self.name = Thread.getName(self)
         ja = []
         jas = []
         self.printid("Thread started")
@@ -646,7 +643,7 @@ threads = []
 cc = min(len(lists), int( multiprocessing.cpu_count() / 2) + 1)
 print("Starting up to %u threads to fetch the %u %s lists" % (cc, len(lists), project))
 for i in range(1,cc+1):
-    t = SlurpThread(i)
+    t = SlurpThread()
     threads.append(t)
     t.start()
     print("Started no. %u" % i)


Mime
View raw message