Coder Social home page Coder Social logo

juntossomosmais / django-outbox-pattern Goto Github PK

View Code? Open in Web Editor NEW
50.0 50.0 7.0 137 KB

A django application to make it easier to use the transactional outbox pattern

License: MIT License

Python 99.53% Dockerfile 0.27% Shell 0.20%
application-events django microservices python transactional-outbox-patterns

django-outbox-pattern's People

Contributors

abxsantos avatar anacarolinacm avatar diegocamacho93 avatar eduard0m0ya avatar eltonjncorreia avatar hugobrilhante avatar lucasssouza1 avatar matheusgeiger avatar ricardochaves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-outbox-pattern's Issues

Implement automatic deletion of old messages to reduce resource usage.

Hello everyone,

I have identified an issue with our library that is causing it to unnecessarily consume resources by allowing the message tables to grow indefinitely. The problem is that the library is not currently set up to automatically delete old messages, which is resulting in a large and ever-growing database.

To address this issue, I propose that we implement a solution that will automatically delete messages after a certain period of time. I suggest setting a default retention period of 7 days, but also providing an option in the Django settings for users to configure the number of days to retain messages.

By implementing this solution, we can significantly reduce the amount of storage and processing power required to maintain our message tables, leading to improved performance and efficiency for our users. I am happy to take on the task of implementing this feature and would appreciate any feedback or suggestions you may have.

Add unique index to message_id column for improved query performance.

Hello everyone,

I have noticed that our library is currently running queries on the msg_id field, which is not indexed. This can become problematic as the message table grows larger, resulting in slower query times and increased load on the database.

To address this issue, I suggest that we create a unique index on the msg_id column. This will significantly improve query performance by reducing the amount of time it takes to search for messages, as well as minimizing the amount of resources needed by the database.

Error when accessing admin page and missing headers

Hello there!

I encountered an error when trying to access the admin page of menu Django Admin > DJANGO_OUTBOX_PATTERN > Receiveds. The error is caused by missing headers that are required for a successful request.

After examining the code, I suspect that the issue may be related to the model field accepting null values, as shown in line 52 of the models.py file. Ideally, the property should exist here, as shown in line 61 of the same file.

However, if the header doesn't exist, it will raise an AttributeError.

Publisher bottleneck

published = self.published_class.objects.filter(

Such an implementation looks like a bottleneck

published = self.published_class.objects.filter(
    status=StatusChoice.SCHEDULE, expires_at__gte=timezone.now()
)
for message in published:
    try:
        attempts = self.producer.send(message)
    except ExceededSendAttemptsException as exc:
        logger.exception(exc)
        message.retry = exc.attempts
        message.status = StatusChoice.FAILED
        message.expires_at = timezone.now() + timedelta(15)
        self.stdout.write(f"Message no published with body:\n{message.body}")
    else:
        message.retry = attempts
        message.status = StatusChoice.SUCCEEDED
        self.stdout.write(f"Message published with body:\n{message.body}")
    finally:
        message.save()

because new messages can arrive faster than once a second

def _waiting():
    sleep(1)

while the solution does not allow itself to be scaled in any way; you cannot simply launch another Publisher, otherwise the message will be sent twice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.