session id is null in pmap

2 views
Skip to first unread message

himangshu

unread,
Oct 11, 2010, 8:31:46 AM10/11/10
to Conjure, hima...@bankbazaar.com
Hi,
I am having a problem in accessing session id in pmap
Requirement: I need to make a large number of lengthy asynchronous web
service calls and display the result of the requests in the front
end.If the process is not complete I need to display it as pending.
My algo: use a pmap where each function stores the return value in the
session.

The problem I am facing is that once I come out of the request thread
and enter each thread of pmap I no longer have reference to the
session id which becomes null.
Here is part of my log
DEBUG [conjure.core.db.flavors.h2]: Executing query: ["SELECT data
FROM sessions WHERE session_id = ''"]
DEBUG [conjure.core.db.flavors.h2]: insert into: :sessions records:
({:created_at "2010-10-11 17:51:04", :session_id nil, :data "

What I want to know is that is there any way to update the session id
in a thread.

Matthew Courtney

unread,
Oct 15, 2010, 8:54:31 AM10/15/10
to clojure...@googlegroups.com
Have you checked out what the request map looks like while in the
thread. The request map is thread local, which means, if you create a
bunch of new threads, you won't have access to the values request-map
was set to in the original thread. The only way to fix this is to
somehow pass the data you need to the new threads, or pass the request
map and reset it in the new threads.

-Matt

himangshu hazarika

unread,
Oct 15, 2010, 9:44:25 AM10/15/10
to clojure...@googlegroups.com
Hi
Matt,
The request-map in the new thread was also empty, I have solved the issue by passing the request-map to the child threads and using binding the passed request map in the server.request namespace.
Regards
Himangshu
Reply all
Reply to author
Forward
0 new messages