# HG changeset patch # User Goffi # Date 1550264779 -3600 # Node ID 728b08c0d0009e03bbb3bd92349df2fb26bacfec # Parent 3fb2ff438f093830fdf1c80969e4ae9aa5711963 storage (pgsql): fixed storage of multiple items diff -r 3fb2ff438f09 -r 728b08c0d000 src/pgsql_storage.py --- a/src/pgsql_storage.py Fri Feb 15 18:05:31 2019 +0100 +++ b/src/pgsql_storage.py Fri Feb 15 22:06:19 2019 +0100 @@ -857,13 +857,19 @@ return u"ORDER BY " + u",".join([col for col in cols_statmnt]) - def storeItems(self, item_data, publisher): - return self.dbpool.runInteraction(self._storeItems, item_data, publisher) + @defer.inlineCallbacks + def storeItems(self, items_data, publisher): + # XXX: runInteraction doesn't seem to work when there are several "insert" + # or "update". + # Before the unpacking was done in _storeItems, but this was causing trouble + # in case of multiple items_data. So this has now be moved here. + # FIXME: investigate the issue with runInteraction + for item_data in items_data: + yield self.dbpool.runInteraction(self._storeItems, item_data, publisher) - def _storeItems(self, cursor, items_data, publisher): + def _storeItems(self, cursor, item_data, publisher): self._checkNodeExists(cursor) - for item_data in items_data: - self._storeItem(cursor, item_data, publisher) + self._storeItem(cursor, item_data, publisher) def _storeItem(self, cursor, item_data, publisher): # first try to insert the item