nakamura committed 3aa7d06

don't call writeEntries() if no entries to save

To avoid unnecessary database open, don't call writeEntries() if there is no
entries to save.

Comments (0)

Files changed (1)


                     msg(u'drop: {0}'.format(entries[i].link))
+            # replace entry with translated one
             entries[i] = entry
+        # filter dropped entries, which is None
+        entries = filter(None, entries)
+        if not entries:
+            # no entries to save. return.
+            return
         retryCount = 10
         for i in range(retryCount):
     def writeEntries(self, entries, feed):
         with as db:
             for entry in entries:
-                if entry is None:
-                    continue
                 db.add(entry, feed.feed.title, feed.url,
                 msg(u'add: {0}'.format(