Skip to content

Commit

Permalink
only add env header if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
indam23 committed Jan 6, 2022
1 parent f00148b commit 527de37
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rasa/core/brokers/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ def _publish(self, event: Dict[Text, Any]) -> None:
else:
partition_key = None

headers = [
(
"RASA_ENVIRONMENT",
bytes(self.rasa_environment, encoding=DEFAULT_ENCODING),
)
]
headers = []
if self.rasa_environment:
headers = [
(
"RASA_ENVIRONMENT",
bytes(self.rasa_environment, encoding=DEFAULT_ENCODING),
)
]

logger.debug(
f"Calling kafka send({self.topic}, value={event},"
Expand Down

0 comments on commit 527de37

Please sign in to comment.