The maximum number of requests (30) allowed for this session has been reached

225 views
Skip to first unread message

lunarjetset

unread,
May 30, 2012, 5:08:47 PM5/30/12
to rav...@googlegroups.com
I believe I'm doing everything right with my session so I'm not totally sure why I'm getting this error.

I open a session , do a number of operations and once complete I call SaveChanges - I am only calling SaveChanges once.

My concern is that perhaps this is an issue with my architecture: I have a Windows Service that is consuming from a RabbitMQ Queue inside a class that exists for the lifetime of the service.  When a message arrives it calls a handler method which opens the session and saves stuff.

I declare a private DocumentStore at the top of that class - does this all make sense - as there is only one instance of the class that runs the DocumentStore there must be only one DocumentStore right?  Or should I be ensuring it's a singleton somehow?

Thanks very much,
Pete

lunarjetset

unread,
May 30, 2012, 5:15:09 PM5/30/12
to rav...@googlegroups.com
Windows Service -> instantiates an App instance in the OnStart of the service.
App constructor calls docStore.Initialize(); on a private DocumentStore

RabbitMQ calls a hander method in App and this performs operations on the class variable DocumentSTore

Is this all safe?

lunarjetset

unread,
May 30, 2012, 5:17:40 PM5/30/12
to rav...@googlegroups.com
the only other possibility that is wrong is this - there are many petes here:

petes.ForEach(session.Store);

                        foreach (var pete in petes)
                        {
                            session.Advanced.GetMetadataFor(opp)["Raven-Expiration-Date"] = new RavenJValue(pete.Expires);
                        }

Chris Marisic

unread,
May 30, 2012, 5:20:20 PM5/30/12
to rav...@googlegroups.com
Where do you create the session and where do you call savechanges?

Can you provide some more information about the infrastructural code you have around this?

lunarjetset

unread,
May 30, 2012, 6:28:42 PM5/30/12
to rav...@googlegroups.com
I'm thinking this was actually around a Load NOT a Save -this was my mistake sorry.  I was calling load too many times in a foreach so I have changed to batch load and I hope this will solve all woes,
thansk
Pete

Oren Eini (Ayende Rahien)

unread,
May 31, 2012, 5:28:51 AM5/31/12
to rav...@googlegroups.com
Yes, you are probably _reading_ data in a loop.
That is far more common than saving in a loop

Pete Nelson

unread,
May 31, 2012, 6:21:51 AM5/31/12
to rav...@googlegroups.com
Thanks - you are right - all sorted now!
Reply all
Reply to author
Forward
0 new messages