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

Question: why am I seeing "NOTICE: function pq_notify does not exist" in the logs? #44

Open
oz123 opened this issue Jan 8, 2020 · 3 comments

Comments

@oz123
Copy link

oz123 commented Jan 8, 2020

I am running the two consumers in docker containers. The to run the process is:

def main(queue_name, processor):
    """
    queue is blocking as long as there are no tasks.
    """
    for i in range(20):
        try:
            pq = PQ(database.connection())
            break
        except peewee.OperationalError as err:
            print(err)
            # the database is still not receiving connections
            if re.search("Connection refused", err.args[0]):
                time.sleep(1)
    try:
        pq.create()
    except errors.DuplicateTable:
        print("queue table already exists")

    queue = pq[queue_name]
    print("waiting for jobs ...")

    for job in queue:
        if job is not None:
            print("Processing job id %d" % job.id)
            try:
                processor(**job.data).process()
            except api.ViesError as E:
                queue.put(job.data, schedule_at='5m')
            except Exception as E:
                print("Something weired happend with that data: ", job.data)
                raise E

When I start a fresh postgresql container I see the following logs:

$ docker logs -f vatprocessor 
Sending emails via smtpd:25
processing vat queue
could not connect to server: Connection refused
	Is the server running on host "db" (172.18.0.2) and accepting
	TCP/IP connections on port 5432?

could not connect to server: Connection refused
	Is the server running on host "db" (172.18.0.2) and accepting
	TCP/IP connections on port 5432?

NOTICE:  function pq_notify() does not exist, skipping

waiting for jobs ...
NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

NOTICE:  function pq_notify() does not exist, skipping

Processing job id 1

If I stop the containers and restart them again, I no longer see the NOTICE message.
As far as I can tell my code works fine, despite the notice. I am just curious to know why I am seeing this message.
I believe it comes for the database it's as I could not find any reference to it in the code.

@oz123
Copy link
Author

oz123 commented Jan 8, 2020

Update, running in the postgress shell:

portal@db:portaldb> drop function if exists pq_notify() cascade;                                                                                                                                                                             
You're about to run a destructive command.
Do you want to proceed? (y/n): y
Your call!
NOTICE:  function pq_notify() does not exist, skipping

DROP FUNCTION
Time: 0.004s
portal@db:portaldb>  

What is calling create during the iteration?

@jobh
Copy link

jobh commented Mar 6, 2020

I think this is probably that the notices are not cleared, and hence they are printed repeatedly whenever the connection is used. See commit 515e7f3.

edit: ...which is part of PR48.

@oz123
Copy link
Author

oz123 commented Mar 6, 2020

@jobh thank you so much for answering and fixing the issue!

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

2 participants