collective.taskqueue saves some headers on the request that queues a job so that later triggering the view that is being queued is as close as possible to the original request.
I found a strange error though, the event handler that queues the view reports:
(Pdb) from zope.globalrequest import getRequest
(Pdb) getRequest()['SERVER_URL']
'https://www.devtest.freitag-verlag.de'
While the view that got queued then reports:
(Pdb) from zope.globalrequest import getRequest
(Pdb) getRequest()['SERVER_URL']
'http://10.100.0.205'
I noticed that because on one of the async views that I have I'm sending emails and on its body I put the URL of an article, and instead of being https://www.freitag.de/autoren/der-freitag/RANDOM-ARTCILE is https://www.freitag.de/website/autoren/der-freitag/RANDOM-ARTCILE, notice the website on it, that's the Plone instance id. I'm just getting an object and calling its absolute_url method (that's a Dexterity Container that ends up calling HTTPRequest.physicalPathFromURL and puts the SERVER_URL).
I tried forcing the header by putting it while queuing the job, i.e
taskqueue.add(view_path, headers={'SERVER_URL': getRequest()['SERVER_URL']})
But somehow even though the header is saved correctly, when the task is picked up again it's discarded and http://10.100.0.205 shows up again.
@datakurre am I doing something wrong or that's a valid bug?
collective.taskqueuesaves some headers on the request that queues a job so that later triggering the view that is being queued is as close as possible to the original request.I found a strange error though, the event handler that queues the view reports:
While the view that got queued then reports:
I noticed that because on one of the async views that I have I'm sending emails and on its body I put the URL of an article, and instead of being
https://www.freitag.de/autoren/der-freitag/RANDOM-ARTCILEishttps://www.freitag.de/website/autoren/der-freitag/RANDOM-ARTCILE, notice the website on it, that's the Plone instance id. I'm just getting an object and calling itsabsolute_urlmethod (that's a Dexterity Container that ends up callingHTTPRequest.physicalPathFromURLand puts theSERVER_URL).I tried forcing the header by putting it while queuing the job, i.e
But somehow even though the header is saved correctly, when the task is picked up again it's discarded and
http://10.100.0.205shows up again.@datakurre am I doing something wrong or that's a valid bug?