Principale utente con più risposte
Mobile service, custom api, script node js

Domanda
-
Good day, I implemented exports.get = function(request,response) of a custom api on a mobile service of azure. I download 5 thousands records from the database and then i prepare the json for the output. The problem is that the time of downloading of all records is too long, for that my script goes into timeout. I was thinking if there is a way to increase the timeout of the response.
Risposte
-
Hi, this is a forum in italian language but we try to help you all the same.
To modify your code take a look at this thread
http://stackoverflow.com/questions/4138470/jquery-getjson-with-timeout
even if increasing timeout is not a correct approach to solve the problem because you could have even many more records in database and you can't every time adjust timeout settings.
Cheers
Edoardo Benussi
Microsoft MVP - Directory Services
edo[at]mvps[dot]org- Proposto come risposta Edoardo BenussiMVP, Moderator venerdì 8 agosto 2014 12:15
- Contrassegnato come risposta Ivanov MetodiMicrosoft contingent staff lunedì 13 ottobre 2014 14:23
Tutte le risposte
-
Hi, this is a forum in italian language but we try to help you all the same.
To modify your code take a look at this thread
http://stackoverflow.com/questions/4138470/jquery-getjson-with-timeout
even if increasing timeout is not a correct approach to solve the problem because you could have even many more records in database and you can't every time adjust timeout settings.
Cheers
Edoardo Benussi
Microsoft MVP - Directory Services
edo[at]mvps[dot]org- Proposto come risposta Edoardo BenussiMVP, Moderator venerdì 8 agosto 2014 12:15
- Contrassegnato come risposta Ivanov MetodiMicrosoft contingent staff lunedì 13 ottobre 2014 14:23
-
Ciao, grazie per la risposta, sono italiano, non so perchè ma pensavo che dovevo scriverlo in inglese. Sono d'accordo che non è il modo giusto per aumentare il time out. Però una volta che ho generato il json, poi alle prossime chiamate non devo reilaborare lo script. So che c'è qualche guida per il caching. Visto che i dati nel db li aggiorno io amministratore dell'app, sono sicuro che i dati verranno aggiornati al max una volta al mese.
Ora per quanto riguarda il link che mi hai segnalato, io sto lavorando lato server-side in node js. Mi pare di capire che non posso usare ajax, giusto?... posterei il codice ma è troppo lungo e creo solo confusione.
Se invece intendevi usare ajax lato client, io sto creando un'applicazione in C# per windows phone. Però anche se aumento il time out lato client, il server va in timeout comunque no? dovrei risolvere il problema lato server giusto?- Modificato roaned venerdì 8 agosto 2014 12:50
-
non so che codice tu abbia scritto quindi mi è difficile darti delle dritte più precise però prova a leggere questo blog-post per vedere un esempio di impostazione del timeout usando node.js
http://code.tutsplus.com/tutorials/learning-server-side-javascript-with-nodejs--net-10044
Edoardo Benussi
Microsoft MVP - Directory Services
edo[at]mvps[dot]org