How to use the aquests.athreads.fifo.await_fifo function in aquests

To help you get started, we’ve selected a few aquests examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hansroh / aquests / aquests / athreads / fifo.py View on Github external
def __len__ (self):
		with self._lock:
			return await_fifo.__len__ (self)
github hansroh / aquests / aquests / athreads / fifo.py View on Github external
def __getitem__(self, index):
		with self._lock:
			return await_fifo.__getitem__ (self, index)
github hansroh / aquests / aquests / athreads / fifo.py View on Github external
def __init__ (self):
		await_fifo.__init__ (self)
		self._lock = threading.Lock ()
github hansroh / aquests / aquests / athreads / fifo.py View on Github external
def insert (self, index, item):
		with self._lock:
			await_fifo.insert (self, index, item)
github hansroh / aquests / aquests / athreads / fifo.py View on Github external
def __setitem__(self, index, item):
		with self._lock:
			await_fifo.__setitem__ (self, index, item)
github hansroh / aquests / aquests / protocols / http2 / fifo.py View on Github external
from ...athreads.fifo import await_fifo, await_ts_fifo

class http2_producer_fifo (await_fifo):
	# asyncore await_fifo replacement
	# for resorting, removeing by http2 priority, cacnel and reset features
	# also can handle producers has 'ready' method
	# this class can be used only at single thread environment

	def remove (self, stream_id):
		if self.l:
			for i in range (len (self.l)):
				try:
					producer_stream_id = self.l [0].stream_id
				except AttributeError:
					pass
				else:
					if producer_stream_id	== stream_id:
						self.l.popleft ()							
				self.l.rotate (1)
github hansroh / aquests / aquests / __init__.py View on Github external
logger = logger_f.screen_logger ()
	_logger = logger

	if qrandom:
		_que = queue.RandomQueue ()
	else:
		_que = queue.Queue ()

	_allow_redirects = allow_redirects
	_force_h1 = request_handler.RequestHandler.FORCE_HTTP_11 = force_http1

	if not use_pool:
		asynconnect.AsynConnect.keep_connect = use_pool
		asynconnect.AsynSSLConnect.keep_connect = use_pool
	if not _force_h1:
		asynconnect.AsynConnect.fifo_class = await_fifo
		asynconnect.AsynSSLConnect.fifo_class = await_fifo

	http2.MAX_HTTP2_CONCURRENT_STREAMS = http2_constreams
	_workers = workers
	_concurrent = workers

	if not force_http1:
		_concurrent = workers * http2_constreams
	elif http2_constreams:
		pass
		#_logger ("parameter http2_constreams is ignored", "warn")

	if callback:
		_cb_gateway = callback

	if cookie:
github hansroh / aquests / aquests / athreads / fifo.py View on Github external
try:
			readyfunc = getattr (item, 'ready')
		except AttributeError:
			pass
		else:	
			if not readyfunc ():
				return self.l.append (item)
				
		return self.l.appendleft (item)
		
	def clear (self):
		self.l.clear ()
		self.has_None = False
	
	
class await_ts_fifo (await_fifo):
	# HTTP/1.x needn't this class, because one channel handles only one request
	# this will be used for handling multiple requests like HTTP/2
	
	def __init__ (self):
		await_fifo.__init__ (self)
		self._lock = threading.Lock ()
	
	def working (self):
		with self._lock:
			return await_fifo.working (self)
		
	def __len__ (self):
		with self._lock:
			return await_fifo.__len__ (self)
			
	def __getitem__(self, index):
github hansroh / aquests / aquests / athreads / fifo.py View on Github external
def working (self):
		with self._lock:
			return await_fifo.working (self)