mirror of
				https://github.com/django/daphne.git
				synced 2025-10-30 23:37:25 +03:00 
			
		
		
		
	Disable linearize until it's reimplemented on sessions.
This commit is contained in:
		
							parent
							
								
									717eb0a100
								
							
						
					
					
						commit
						5fa357e403
					
				|  | @ -14,23 +14,22 @@ def linearize(func): | |||
|     up before the first has exited and saved its session. Doesn't guarantee | ||||
|     ordering, just linearity. | ||||
|     """ | ||||
|     raise NotImplementedError("Not yet reimplemented") | ||||
|     @functools.wraps(func) | ||||
|     def inner(message, *args, **kwargs): | ||||
|         # Make sure there's a reply channel | ||||
|         if not message.reply_channel: | ||||
|             raise ValueError( | ||||
|                 "No reply_channel sent to consumer; @no_overlap can only be used on messages containing it." | ||||
|                 "No reply_channel in message; @linearize can only be used on messages containing it." | ||||
|             ) | ||||
| 
 | ||||
|         # Get the lock, or re-queue | ||||
|         locked = message.channel_backend.lock_channel(message.reply_channel) | ||||
|         if not locked: | ||||
|             raise message.Requeue() | ||||
|         # TODO: Get lock here | ||||
|         pass | ||||
|         # OK, keep going | ||||
|         try: | ||||
|             return func(message, *args, **kwargs) | ||||
|         finally: | ||||
|             message.channel_backend.unlock_channel(message.reply_channel) | ||||
|             # TODO: Release lock here | ||||
|             pass | ||||
|     return inner | ||||
| 
 | ||||
| 
 | ||||
|  | @ -47,7 +46,8 @@ def channel_session(func): | |||
|         # Make sure there's a reply_channel | ||||
|         if not message.reply_channel: | ||||
|             raise ValueError( | ||||
|                 "No reply_channel sent to consumer; @no_overlap can only be used on messages containing it." | ||||
|                 "No reply_channel sent to consumer; @channel_session " + | ||||
|                 "can only be used on messages containing it." | ||||
|             ) | ||||
| 
 | ||||
|         # Make sure there's NOT a channel_session already | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user