Skip to content

Do control-and-reply with existing (synchronous) Django connection #37

@AlanCoding

Description

@AlanCoding

The historical code for the dispatcher Control operations did nothing asyncio, and avoided creating a new connection.

https://github.com/ansible/awx/blob/9a5ed20ed5c9e90ffde2e014885f616ac9606b52/awx/main/dispatch/control.py#L61

Some time around 8abf22b, I changed the pattern to creating a new connection, due to the unavoidable performance problems with the Django connection we're given. In AWX we have very custom stuff to wait for new notifications up until a timeout.

However, AWX appears to be doing things incorrectly in that the pg_bus_conn never uses the .unlisten method. It does close a connection if it created a new connection, but this isn't enough. With a new connection, you keep the connection, but you need to unsubscribe from all the pg_notify channels.

To get a solution for a timeout, maybe a simple ordinary python thread would be the right solution.

I'm thinking that testing this will involve creating a new "test_app" type Django app using the existing authentication to the existing database, because any tables it creates are non-conflicting with pg_notify channels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringcode build-out and clean-up

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions