Skip to content

Commit

Permalink
fix some issues and set atomic requests to production
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanogueira committed Apr 25, 2024
1 parent 9602e81 commit 3ff8fec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {"default": env.db("DATABASE_URL")}
DATABASES["default"]["ATOMIC_REQUESTS"] = True
DATABASES["default"]["ATOMIC_REQUESTS"] = False
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-DEFAULT_AUTO_FIELD
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

Expand Down
1 change: 1 addition & 0 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# DATABASES
# ------------------------------------------------------------------------------
DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60)
DATABASES["default"]["ATOMIC_REQUESTS"] = True # noqa F405

# CACHES
# ------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def handle(self, *args, **options):
)
open_messages = Message.objects.filter(
connector__id=from_connector,
open=True
delivered=False
)
if open_chats.count():
from_connector_object = open_chats.first().connector
Expand Down
12 changes: 7 additions & 5 deletions rocket_connect/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,12 +1107,14 @@ def ingoing(self):
self.handle_livechat_session_queued()
if self.message.get("type") == "Message":
message, created = self.register_message()
ignore_close_message = (
self.message_object.room.token
in self.config.get("ignore_token_force_close_message", "").split(
",",
# TODO: message may not habe room
if self.message_object:
ignore_close_message = (
self.message_object.room.token
in self.config.get("ignore_token_force_close_message", "").split(
",",
)
)
)
if not message.delivered:
# prepare message to be sent to client
for message in self.message.get("messages", []):
Expand Down

0 comments on commit 3ff8fec

Please sign in to comment.