mirror of
				https://github.com/django/daphne.git
				synced 2025-10-30 15:27:36 +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 |     up before the first has exited and saved its session. Doesn't guarantee | ||||||
|     ordering, just linearity. |     ordering, just linearity. | ||||||
|     """ |     """ | ||||||
|  |     raise NotImplementedError("Not yet reimplemented") | ||||||
|     @functools.wraps(func) |     @functools.wraps(func) | ||||||
|     def inner(message, *args, **kwargs): |     def inner(message, *args, **kwargs): | ||||||
|         # Make sure there's a reply channel |         # Make sure there's a reply channel | ||||||
|         if not message.reply_channel: |         if not message.reply_channel: | ||||||
|             raise ValueError( |             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." | ||||||
|             ) |             ) | ||||||
| 
 |         # TODO: Get lock here | ||||||
|         # Get the lock, or re-queue |         pass | ||||||
|         locked = message.channel_backend.lock_channel(message.reply_channel) |  | ||||||
|         if not locked: |  | ||||||
|             raise message.Requeue() |  | ||||||
|         # OK, keep going |         # OK, keep going | ||||||
|         try: |         try: | ||||||
|             return func(message, *args, **kwargs) |             return func(message, *args, **kwargs) | ||||||
|         finally: |         finally: | ||||||
|             message.channel_backend.unlock_channel(message.reply_channel) |             # TODO: Release lock here | ||||||
|  |             pass | ||||||
|     return inner |     return inner | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -47,7 +46,8 @@ def channel_session(func): | ||||||
|         # Make sure there's a reply_channel |         # Make sure there's a reply_channel | ||||||
|         if not message.reply_channel: |         if not message.reply_channel: | ||||||
|             raise ValueError( |             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 |         # Make sure there's NOT a channel_session already | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user