1

I'm working on an application and i want to understand it's behavior.

Once i have already logged into the system i make one request through ajax to the back-end, it's a void method that will process some information and feed a table.

Meanwhile i have another tab, also in the same session as the one that called the void method, and i want to go to the system's dashboard, so i press the corresponding button in the menu. This second tab will ONLY go to the dashboard when the void method is done.

Why? I would need static webservices to do that for me? I assumed that once it's a void method and i don't need its answer that would work.

tereško
  • 58,060
  • 25
  • 98
  • 150
v1n1akabozo
  • 257
  • 1
  • 4
  • 11
  • What is problem? void API method returns HTTP 204. If method raises exception it returns HTTP 500 – ApceH Hypocrite Aug 13 '14 at 06:51
  • This may be relevant http://stackoverflow.com/questions/1906023/jquery-ajaxerror-handler-fires-if-user-leaves-page-before-page-finishes-loadin – Andrew Savinykh Aug 13 '14 at 06:53
  • I vote to close because it is not clear what the actual problem is. Is it something with ajax, mvc, c#, javascript or maybe a conceptual issue? – Wiktor Zychla Aug 13 '14 at 08:03
  • I am sorry if the question wasn't clear enough. All i want to know if there's some sort of queue attached to the session. If i can't perform 2 GETS at the same time. My problem is that i couldnt ask for another page while that void ajax request was still running and i wanted to know if that was due a lock in the database or if i was missing concepts regarding mvc – v1n1akabozo Aug 13 '14 at 13:09

1 Answers1

1

You need to provide more details about the state of the application during the execution and the conditions around your requests.

If you're using AJAX to call the backend method and it doesn't return anything, your second request in the other tab should process normally. Web Applications are usually capable of handling multiple requests almost simoultaneously (barring any DDoS attack or unusually high load limits reached), so one thing i would ask is ¿are you debugging the application while sending the second request?, if you have a breakpoint on the server method that's being called and it's being hit by your first request, you need to step out of that execution manually before you can process the next request.

Another thing you might want to review is, if this method is a very resource/time-consuming operation, you might want to use tasks or threads to avoid creating bottlenecks between requests.

M.K.S.
  • 171
  • 3
  • the last part of your answer might be what i need. Let's picture this situation: I just logged on my MVC application, authorized by simple membership, went to a screen and pressed a button that calls a void method that i created. My goal was that this method would run on background without affecting the user that called the method, and would keep running even if the session expires (like a stored procedure would, or a static webservice would, i guess), but what happens is that it seems that even though it's a void method called through ajax i can't make more requests, like going to other page – v1n1akabozo Aug 15 '14 at 13:26
  • (cont..) Yes, it's a very demanding method, and i don't need to wait it to end to keep using the system, i just need it to run on the background. The way it behaves now, it seems like there's a queue attached to the session (first come, first served). I'm assuming that because in this session A i can't even refresh the page. But if i open the system in another browser, or even in anonymous mode and log on the system (with the same credentials, but it creates another session, call it B), i can access any pages without having to wait, which doesn't happens to session A. – v1n1akabozo Aug 15 '14 at 13:30
  • Oh, and i'm not debugging it, it's running on production server, and the server itself is pretty robust – v1n1akabozo Aug 15 '14 at 13:40