Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior for recovery and multiple handlers #84

Open
spapas opened this issue Nov 4, 2024 · 0 comments
Open

Strange behavior for recovery and multiple handlers #84

spapas opened this issue Nov 4, 2024 · 0 comments

Comments

@spapas
Copy link

spapas commented Nov 4, 2024

Hello friends, I'm using this app on a django project in windows and getting these two problems:

1
I want to store the notifications so they won't get missed. This seems to be working however when I run the worker with dj listen --recover --worker-start-method=spawn I get something:

2024-11-04 12:33:20,694 INFO Processing all notifications for channel pycensus.oldcensus.channels.SampleChannel
2024-11-04 12:33:20,695 INFO Found notifications: <generator object QuerySet._iterator at 0x0000025C8CB4BA40>
2024-11-04 12:33:20,708 INFO Listening for notifications...

however the handlers for the old notifications are not running (I've got a print function there and it doesn't display)

2

When I run two handlers together I get the following messages on both:

2024-11-04 12:43:37,311 INFO Processing notification for pycensus.oldcensus.channels.SampleChannel
2024-11-04 12:43:37,315 INFO Could not obtain a lock on notification 2787277

I would expect one of the handlers to obtain the lock.

If it helps, here is the definition of my channel:

@dataclass
class SampleChannel(Channel):
    lock_notifications = True
    x: int
    y: str

and my handler

@pgpubsub.listener(channels.SampleChannel)
def update_post_reads_per_date_cache(x: int, y: str) -> None:
    print(f"Updating cache for model {x} on {y}")

I'm using Django==5.1.2, django-pgpubsub==1.3.0, psql server 15.8 and windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant