josedasilva @ 16:51

Qua, 20/09/06

Pois é, o uso detse tipo de técnicas, onde não temos o total controlo sobre a velocidade e ordem de recepção de pedidos leva por vezes a histórias destas, aliás é por isso mesmo se chama assíncrono.

Num dos testes de laboratório que tanto gosto de efectuar, estive a testar multiplos pedidos simulâneos assincronos, o que me levou à descoberta de um possível problema, quando não temos em mente que dois pedidos assíncronos, efectuados no mesmo momento, podem ter tempos de resposta variáveis.

Imaginemos a seguinte iteracção:

1. Click num qualquer botão leva ás seguintes acções:

1. Envio de pedido para alterar o estado de um registo na base de dados e actualização da "div" actual
2. Envio de pedido de actualização de uma segunda "div" com o registo editado anteriomente já actualizado

A ideia é simples, imaginem-se duas listas, onde numa se listam registos activos e na outra se listam registos inactivos. Imagine-se que se deseja inactivar um registo, a estratégia passa por actualizar o registo na base de dados como inactivo e actualizar ambas as listas de modo a que o registo passe a constar imediatamente da lista certa.



  1. function deleteRecord() {

  2. doAjaxTODeleteRecordAndUpdateDeletedRecordList() ;

  3. doAjaxTOUpdateActiveRecordsList();

  4. }



O problema ocorre quando o pedido assíncrono de edição do registo para estado inactivo é executado após o pedido de actualização das listas. No meu caso o registo de edição era efectuado antes da actualização das listas, umas vezes e noutras nem por isso.

A solução poderia passar por:



  1. function deleteRecord() {

  2. doAjaxTODeleteRecordAndUpdateDeletedRecordList();

  3. setTimeout(doAjaxTOUpdateActiveRecordsList(),1000);

  4. }



A solução pode passar por obrigar o segundo pedido a ter um delay de alguns micro segundos, não garante que é tratado antes, mas garante que existem infimas probabilidades de não o ser. Ou então executar apenas o segundo pedido quando recebermos a resposta do primeiro.
UPDATE [21 Set 2006]
O Marco, do Webaserio, apresentou uma outra solução para o problema, basicamente a alternativa dele seria actualizar as duas listas na mesma chamada assíncrona, eliminando assim uma das chamadas e conseguindo garantir a ordem das respostas. Outra das soluções falada, em conversa com ele, era a da possibilidade de efectuar a actualização das listas apenas com javascript, e esta seria a solução mais eficaz, que sonsistia em mudar os elementos de lista usando javascript, directamente no DOM.Existem diversas formas de efectuar o mesmo procedimento, vamos ter de optar pela mais correcta dado o problema.

Tags:

YjwfIQxCW @ 09:22

Sab, 29/11/14

 

peoples pharmacy column the oregonian, cipro change stool color (https://archive.org/details/WhereCanIPurchaseCheapApcalisROralJelly20mgInMontgomery), [url="https://archive.org/details/WhereCanIPurchaseCheapApcalisROralJelly20mgInMontgomery"]cipro change stool color[/url], https://archive.org/details/WhereCanIPurchaseCheapApcalisROralJelly20mgInMontgomery cipro change stool color, 6758, ciloxan online (http://support.modelmanagement.com/entries/39030575-Generic-Ciloxan-Online-Pharmacy-No-Membership-ciloxan-ointment-generic), [url="http://support.modelmanagement.com/entries/39030575-Generic-Ciloxan-Online-Pharmacy-No-Membership-ciloxan-ointment-generic"]ciloxan online[/url], http://support.modelmanagement.com/entries/39030575-Generic-Ciloxan-Online-Pharmacy-No-Membership-ciloxan-ointment-generic ciloxan online, 73357, ciloxan reactions (http://mocbudesde.nation2.com/index.php?page=1282003925), [url="http://mocbudesde.nation2.com/index.php?page=1282003925"]ciloxan reactions[/url], http://mocbudesde.nation2.com/index.php?page=1282003925 ciloxan reactions, 7026, ciloxan animals (http://fieciafranla.jottit.com/generic_ciloxan_over_the_counter_online_no_prescription), [url="http://fieciafranla.jottit.com/generic_ciloxan_over_the_counter_online_no_prescription"]ciloxan animals[/url], http://fieciafranla.jottit.com/generic_ciloxan_over_the_counter_online_no_prescription ciloxan animals, 7748, ciloxan reactions (http://snk.to/E56F), [url="http://snk.to/E56F"]ciloxan reactions[/url], http://snk.to/E56F ciloxan reactions, 5679,

sZyGuVAfEAGQsgmhpfb @ 00:21

Seg, 01/12/14

 

axium pharmacy, about ramipril capsules (http://eralvido.webpin.com/blog_323585_Without-Prescription-FDA-Approved-Ramipril-2-5mg-in-Berkeley-ramipril-cautions.html), [url="http://eralvido.webpin.com/blog_323585_Without-Prescription-FDA-Approved-Ramipril-2-5mg-in-Berkeley-ramipril-cautions.html"]about ramipril capsules[/url], http://eralvido.webpin.com/blog_323585_Without-Prescription-FDA-Approved-Ramipril-2-5mg-in-Berkeley-ramipril-cautions.html about ramipril capsules, menv, indapamide perindopril combination (http://www.looduspere.ee/ForumRetrieve.aspx?ForumID=1285&TopicID=178762&NoTemplate=False), [url="http://www.looduspere.ee/ForumRetrieve.aspx?ForumID=1285&TopicID=178762&NoTemplate=False"]indapamide perindopril combination[/url], http://www.looduspere.ee/ForumRetrieve.aspx?ForumID=1285&TopicID=178762&NoTemplate=False indapamide perindopril combination, %]]],

pSlgPcZAv @ 13:05

Seg, 01/12/14

 

online pharmacy no membership, doxycycline rifaximin (http://marmaletal.soup.io/post/448600875/Amex-Online-FDA-Approved-Rifaximin-400mg-in), [url="http://marmaletal.soup.io/post/448600875/Amex-Online-FDA-Approved-Rifaximin-400mg-in"]doxycycline rifaximin[/url], http://marmaletal.soup.io/post/448600875/Amex-Online-FDA-Approved-Rifaximin-400mg-in doxycycline rifaximin, 71621, cipro xifaxan interaction (http://eqelundia.soup.io/post/447392715/FDA-Approved-Rcifax-No-Prescription-Needed-in), [url="http://eqelundia.soup.io/post/447392715/FDA-Approved-Rcifax-No-Prescription-Needed-in"]cipro xifaxan interaction[/url], http://eqelundia.soup.io/post/447392715/FDA-Approved-Rcifax-No-Prescription-Needed-in cipro xifaxan interaction, 608,

IuSWGkegGapJ @ 19:31

Seg, 01/12/14

 

old pharmaceutical compounds, does nitrofurantoin mono mac affect birth control (http://hotelgoldenorchid.com/ForumRetrieve.aspx?ForumID=729&TopicID=448496&NoTemplate=False), [url="http://hotelgoldenorchid.com/ForumRetrieve.aspx?ForumID=729&TopicID=448496&NoTemplate=False"]does nitrofurantoin mono mac affect birth control[/url], http://hotelgoldenorchid.com/ForumRetrieve.aspx?ForumID=729&TopicID=448496&NoTemplate=False does nitrofurantoin mono mac affect birth control, afh, how long before nitrofurantoin offers relief (http://jeanettejenningsart.com/ForumRetrieve.aspx?ForumID=317&TopicID=822981&NoTemplate=False), [url="http://jeanettejenningsart.com/ForumRetrieve.aspx?ForumID=317&TopicID=822981&NoTemplate=False"]how long before nitrofurantoin offers relief[/url], http://jeanettejenningsart.com/ForumRetrieve.aspx?ForumID=317&TopicID=822981&NoTemplate=False how long before nitrofurantoin offers relief, 51909, metformin xr diarrhoea (http://support.zenlayout.com/entries/87202183-FDA-Approved-Okamet-850mg-Over-The-Counter-With-Visa-Online-No-Prescription-in-Sterling-Heights-gluc), [url="http://support.zenlayout.com/entries/87202183-FDA-Approved-Okamet-850mg-Over-The-Counter-With-Visa-Online-No-Prescription-in-Sterling-Heights-gluc"]metformin xr diarrhoea[/url], http://support.zenlayout.com/entries/87202183-FDA-Approved-Okamet-850mg-Over-The-Counter-With-Visa-Online-No-Prescription-in-Sterling-Heights-gluc metformin xr diarrhoea, 37184,

uffeZnHXnrgljODoc @ 01:38

Ter, 02/12/14

 

pharmacy anchorage ak, nitrofurantoin dosage duration (https://mintpics.zendesk.com/entries/86791803-Where-Can-I-Get-Cheap-Generic-Martifur-50mg-in-Tampa-nitrofurantoin-mono-mac-treats), [url="https://mintpics.zendesk.com/entries/86791803-Where-Can-I-Get-Cheap-Generic-Martifur-50mg-in-Tampa-nitrofurantoin-mono-mac-treats"]nitrofurantoin dosage duration[/url], https://mintpics.zendesk.com/entries/86791803-Where-Can-I-Get-Cheap-Generic-Martifur-50mg-in-Tampa-nitrofurantoin-mono-mac-treats nitrofurantoin dosage duration, 9363, nitrofurantoin for acute cystitis (http://support.grappster.com/entries/90822536-Online-Pharmacy-No-Membership-Generic-Martifur-100mg-in-South-Bend-nitrofurantoin-cyp450), [url="http://support.grappster.com/entries/90822536-Online-Pharmacy-No-Membership-Generic-Martifur-100mg-in-South-Bend-nitrofurantoin-cyp450"]nitrofurantoin for acute cystitis[/url], http://support.grappster.com/entries/90822536-Online-Pharmacy-No-Membership-Generic-Martifur-100mg-in-South-Bend-nitrofurantoin-cyp450 nitrofurantoin for acute cystitis, 943,

sacrsMGEbHZCRt @ 08:27

Ter, 02/12/14

 

pharmacology 2000, clindamycin scleroderma (http://example9.lespaceonline.com/ForumRetrieve.aspx?ForumID=729&TopicID=360035&NoTemplate=False), [url="http://example9.lespaceonline.com/ForumRetrieve.aspx?ForumID=729&TopicID=360035&NoTemplate=False"]clindamycin scleroderma[/url], http://example9.lespaceonline.com/ForumRetrieve.aspx?ForumID=729&TopicID=360035&NoTemplate=False clindamycin scleroderma, gyjg, clindamycin hydrochloride 300 mg dosage (http://support.globasure.net/entries/91626386-Over-The-Counter-With-MasterCard-No-Prescription-No-Membership-FDA-Approved-ClindaMax-150mg-in-Charl), [url="http://support.globasure.net/entries/91626386-Over-The-Counter-With-MasterCard-No-Prescription-No-Membership-FDA-Approved-ClindaMax-150mg-in-Charl"]clindamycin hydrochloride 300 mg dosage[/url], http://support.globasure.net/entries/91626386-Over-The-Counter-With-MasterCard-No-Prescription-No-Membership-FDA-Approved-ClindaMax-150mg-in-Charl clindamycin hydrochloride 300 mg dosage, :-PP, clindamycin inclusion criteria (http://neysucamic.soup.io/post/447205506/Where-To-Buy-Cheap-Clindamycin-With-Visa), [url="http://neysucamic.soup.io/post/447205506/Where-To-Buy-Cheap-Clindamycin-With-Visa"]clindamycin inclusion criteria[/url], http://neysucamic.soup.io/post/447205506/Where-To-Buy-Cheap-Clindamycin-With-Visa clindamycin inclusion criteria, 8)),

kHiQIHxAynADYF @ 15:32

Ter, 02/12/14

 

farco-pharma gmbh, clindamycin bariatric surgery (http://www.ecogroupint.com/ForumRetrieve.aspx?ForumID=317&TopicID=874962&NoTemplate=False), [url="http://www.ecogroupint.com/ForumRetrieve.aspx?ForumID=317&TopicID=874962&NoTemplate=False"]clindamycin bariatric surgery[/url], http://www.ecogroupint.com/ForumRetrieve.aspx?ForumID=317&TopicID=874962&NoTemplate=False clindamycin bariatric surgery, 8-D, clindamycin norvasc (http://counymiro.soup.io/post/448839000/Order-Cheapest-ClindaMax-300mg-in-Salvador), [url="http://counymiro.soup.io/post/448839000/Order-Cheapest-ClindaMax-300mg-in-Salvador"]clindamycin norvasc[/url], http://counymiro.soup.io/post/448839000/Order-Cheapest-ClindaMax-300mg-in-Salvador clindamycin norvasc, 8(((,

YlKsoVQEpvDXEQ @ 21:59

Ter, 02/12/14

 

corporate pharmaceutical company jobs, reaction to chloramphenicol (http://www.epilepsywa.asn.au/ForumRetrieve.aspx?ForumID=546&TopicID=373259&NoTemplate=False), [url="http://www.epilepsywa.asn.au/ForumRetrieve.aspx?ForumID=546&TopicID=373259&NoTemplate=False"]reaction to chloramphenicol[/url], http://www.epilepsywa.asn.au/ForumRetrieve.aspx?ForumID=546&TopicID=373259&NoTemplate=False reaction to chloramphenicol, 6083, cialis medical products (http://www.thediversitydashboard.com/ForumRetrieve.aspx?ForumID=729&TopicID=349062&NoTemplate=False), [url="http://www.thediversitydashboard.com/ForumRetrieve.aspx?ForumID=729&TopicID=349062&NoTemplate=False"]cialis medical products[/url], http://www.thediversitydashboard.com/ForumRetrieve.aspx?ForumID=729&TopicID=349062&NoTemplate=False cialis medical products, qobxa,

lkWSASWtjROWHCOMlWK @ 04:05

Qua, 03/12/14

 

basic pharmacokinetic, gabapentin for panic attacks (http://askaspeechie.positionmeonline.com/ForumRetrieve.aspx?ForumID=1602&TopicID=819652&NoTemplate=False), [url="http://askaspeechie.positionmeonline.com/ForumRetrieve.aspx?ForumID=1602&TopicID=819652&NoTemplate=False"]gabapentin for panic attacks[/url], http://askaspeechie.positionmeonline.com/ForumRetrieve.aspx?ForumID=1602&TopicID=819652&NoTemplate=False gabapentin for panic attacks, 881858, moduretic substitute (https://customerservice.tvins.com/entries/88312286-Order-Generic-Amiloride-5mg-hydrochlorothiazide-50mg-Over-The-Counter-With-MasterCard-No-Prescriptio), [url="https://customerservice.tvins.com/entries/88312286-Order-Generic-Amiloride-5mg-hydrochlorothiazide-50mg-Over-The-Counter-With-MasterCard-No-Prescriptio"]moduretic substitute[/url], https://customerservice.tvins.com/entries/88312286-Order-Generic-Amiloride-5mg-hydrochlorothiazide-50mg-Over-The-Counter-With-MasterCard-No-Prescriptio moduretic substitute, =-DDD, taking neurontin advil (https://homtur.zendesk.com/entries/90209993-FDA-Approved-Gabapentin-400mg-Over-The-Counter-No-Prescription-No-Membership-in-Midland-what-does-ga), [url="https://homtur.zendesk.com/entries/90209993-FDA-Approved-Gabapentin-400mg-Over-The-Counter-No-Prescription-No-Membership-in-Midland-what-does-ga"]taking neurontin advil[/url], https://homtur.zendesk.com/entries/90209993-FDA-Approved-Gabapentin-400mg-Over-The-Counter-No-Prescription-No-Membership-in-Midland-what-does-ga taking neurontin advil, 7853,

lWbBvvvLHOciW @ 18:17

Qua, 03/12/14

 

university of florida pharmacy application, lisinopril pronounce (http://www.petroniuswines.com/ForumRetrieve.aspx?ForumID=2827&TopicID=175154&NoTemplate=False), [url="http://www.petroniuswines.com/ForumRetrieve.aspx?ForumID=2827&TopicID=175154&NoTemplate=False"]lisinopril pronounce[/url], http://www.petroniuswines.com/ForumRetrieve.aspx?ForumID=2827&TopicID=175154&NoTemplate=False lisinopril pronounce, 655997, zetia ezetimibe 10 mg (http://support.guestdesk.com/entries/51283474-Order-Generic-Ezentia-10mg-in-Bellevue-simvastatin-ezetimibe-dissolution), [url="http://support.guestdesk.com/entries/51283474-Order-Generic-Ezentia-10mg-in-Bellevue-simvastatin-ezetimibe-dissolution"]zetia ezetimibe 10 mg[/url], http://support.guestdesk.com/entries/51283474-Order-Generic-Ezentia-10mg-in-Bellevue-simvastatin-ezetimibe-dissolution zetia ezetimibe 10 mg, %))),

Blog pessoal de José Silva. Sou programador informático, nos últimos anos dedicado quase exclusivamente ao PHP.
Setembro 2006
Dom
Seg
Ter
Qua
Qui
Sex
Sab

1
2

3
4
5
6
7
8
9

10
12
13
14
16

17
18
19
21
23

24
25
26
27
28
29
30


Pesquisar
 
blogs SAPO