[Glass] How to make Seaside ignore a repeat request

Trussardi Dario Romano via Glass glass at lists.gemtalksystems.com
Thu Nov 1 03:21:13 PDT 2018


Ciao,


> I have a situation where some requests may take a long time, resulting in the
> user getting impatient and triggering the request again. If the second
> request cannot get the lock while the first is processing, the request
> processing loop retries for a total of 10 attempts before giving up. 
> (This is especially critical when the default #retryDelays of 23.31 seconds
> is too long and have been shortened.)
> 
> Short of fixing the thing that takes a ridiculously long time, what can I do
> to prevent or ignore the user triggering the request a second time and
> perhaps getting back a /Too many retries: 11/ response instead of what was
> requested?
> 
> Is there a way to disable the UI while a request is being processed?
> Is there a way to produce a "null response" that won't try to update the
> display in the browser?
> 

	My solution:

		When i render the anchor 		 where relative requests may take a long time 

		i do: 

			html div with:[
		
					 self renderSomeDataToDisplayOn:html.	 " data user informations "

				"A"	self renderHiddenBarOn: html.

				"B"	self renderCommandOn: html 


		Where:
		
			A) i render a hidden  progress "widget" 

				self renderHiddenBarOn: html.

					html div id: 'prgDiv' ;
						class:'loader';
						style:'display: none; margin: 5px auto;'.
	

			2)	self renderCommandOn: html 

				html div id: ( self divReferencePrefix: 'cmdDiv' for: self ); class: 'command'; with:[

					html anchor
						callback:[ | aBlock  |		 ];
					
						onClick: ( self onClickUpdateFor: self on: html);
						
						title:  'title;
				
						with: 'Anchor for a long time requestA'.

		
					html anchor ............



			2A ) the  onClickUpdateFor: self on: html

				^( html jQuery ajax  
					script: [ :s | 
							s << (( s jQuery class: 'command'   )  hide ).
							s << (( html jQuery: ( 'prgDiv' )) show) ])


	When the user click on the anchor	 the system display a progress bar and hidden all the other command.

	The browser appears to be locked until it receives the response from the server.

	And what were you looking for?

	How much report is a summary, but I think there is everything to try.

	Eventually let me know.

	Ciao,

		Dario


	The relative css data are:

.loader {
    border: 16px solid #f3f3f3; /* Light grey */
    border-top: 16px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 44px;
    height: 44px;
    animation: spin 2s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@-webkit-keyframes blinker
{
0% { opacity: 0.3; }
50% { opacity: 1.0; }
100% { opacity: 0.3; }
}
.css3_blink
{
-webkit-animation-name: blinker;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: cubic-bezier(.5, 0, 1, 1);
-webkit-animation-duration: 1.7s;
color: red;
}
'


		
					
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20181101/62b9c7aa/attachment.html>


More information about the Glass mailing list