small consumer fixes

This commit is contained in:
Jonas Winkler 2020-11-11 14:14:21 +01:00
parent 6795580739
commit 02ef7cb038

View File

@ -60,7 +60,6 @@ class Consumer:
raise ConsumerError( raise ConsumerError(
"Consumption directory {} does not exist".format(self.consume)) "Consumption directory {} does not exist".format(self.consume))
def log(self, level, message): def log(self, level, message):
getattr(self.logger, level)(message, extra={ getattr(self.logger, level)(message, extra={
"group": self.logging_group "group": self.logging_group
@ -98,7 +97,6 @@ class Consumer:
else: else:
self.log("info", "Parser: {}".format(parser_class.__name__)) self.log("info", "Parser: {}".format(parser_class.__name__))
document_consumption_started.send( document_consumption_started.send(
sender=self.__class__, sender=self.__class__,
filename=doc, filename=doc,
@ -110,9 +108,10 @@ class Consumer:
try: try:
self.log("info", "Generating thumbnail for {}...".format(doc)) self.log("info", "Generating thumbnail for {}...".format(doc))
thumbnail = document_parser.get_optimised_thumbnail() thumbnail = document_parser.get_optimised_thumbnail()
text = document_parser.get_text()
date = document_parser.get_date() date = document_parser.get_date()
document = self._store( document = self._store(
document_parser.get_text(), text,
doc, doc,
thumbnail, thumbnail,
date date