d8cc86eff4 
								
									
								
							
								 
							
						 
						
							
							
								
								Remove redundant types from comments. ( #14412 )  
							
							... 
							
							
							
							Remove type hints from comments which have been added
as Python type hints. This helps avoid drift between comments
and reality, as well as removing redundant information.
Also adds some missing type hints which were simple to fill in. 
							
						 
						
							2022-11-16 15:25:24 +00:00  
				
					
						
							
							
								 
						
							
							
								1eea73b413 
								
									
								
							
								 
							
						 
						
							
							
								
								Fix rate limit metrics registering twice and misreporting ( #13649 )  
							
							... 
							
							
							
							* Fix rate limit metrics registering twice and misreporting
Fix https://github.com/matrix-org/synapse/issues/13641 
* Fix lints
* Add changelog
* Document `metrics_name=None`. 
							
						 
						
							2022-08-30 12:08:29 +01:00  
				
					
						
							
							
								 
						
							
							
								b251cff819 
								
									
								
							
								 
							
						 
						
							
							
								
								Fix incorrect juggling of logging contexts in `_PerHostRatelimiter` ( #13554 )  
							
							... 
							
							
							
							Signed-off-by: Sean Quah <seanq@matrix.org>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> 
							
						 
						
							2022-08-18 16:26:26 +01:00  
				
					
						
							
							
								 
						
							
							
								d64653d062 
								
									
								
							
								 
							
						 
						
							
							
								
								Track number of hosts affected by the rate limiter ( #13541 )  
							
							... 
							
							
							
							Track number of hosts affected by the rate limiter so we can differentiate one really noisy homeserver from a general ratelimit tuning problem across the federation.
Follow-up to https://github.com/matrix-org/synapse/pull/13534 
Part of https://github.com/matrix-org/synapse/issues/13356  
							
						 
						
							2022-08-18 10:05:07 -05:00  
				
					
						
							
							
								 
						
							
							
								49d04e43df 
								
									
								
							
								 
							
						 
						
							
							
								
								Add metrics to track how the rate limiter is affecting requests (sleep/reject) ( #13534 )  
							
							... 
							
							
							
							Related to https://github.com/matrix-org/synapse/pull/13499 
Part of https://github.com/matrix-org/synapse/issues/13356  
							
						 
						
							2022-08-17 16:10:07 -05:00  
				
					
						
							
							
								 
						
							
							
								c6ee9c0ee4 
								
									
								
							
								 
							
						 
						
							
							
								
								Add metrics to track rate limiter queue timing ( #13544 )  
							
							
							
						 
						
							2022-08-17 10:38:05 +01:00  
				
					
						
							
							
								 
						
							
							
								344a2f767c 
								
									
								
							
								 
							
						 
						
							
							
								
								Instrument `FederationStateIdsServlet` - `/state_ids` ( #13499 )  
							
							... 
							
							
							
							Instrument FederationStateIdsServlet - `/state_ids` so it's easier to follow what's going on in Jaeger when viewing a trace. 
							
						 
						
							2022-08-15 19:41:23 +01:00  
				
					
						
							
							
								 
						
							
							
								d6e94ad9d9 
								
									
								
							
								 
							
						 
						
							
							
								
								Rename `RateLimitConfig` to `RatelimitSettings` ( #13442 )  
							
							
							
						 
						
							2022-08-03 10:40:20 +01:00  
				
					
						
							
							
								 
						
							
							
								524b8ead77 
								
									
								
							
								 
							
						 
						
							
							
								
								Add types to synapse.util. ( #10601 )  
							
							
							
						 
						
							2021-09-10 17:03:18 +01:00  
				
					
						
							
							
								 
						
							
							
								4b965c862d 
								
									
								
							
								 
							
						 
						
							
							
								
								Remove redundant "coding: utf-8" lines ( #9786 )  
							
							... 
							
							
							
							Part of #9744 
Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now.
`Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>` 
							
						 
						
							2021-04-14 15:34:27 +01:00  
				
					
						
							
							
								 
						
							
							
								c619253db8 
								
									
								
							
								 
							
						 
						
							
							
								
								Stop sub-classing object ( #8249 )  
							
							
							
						 
						
							2020-09-04 06:54:56 -04:00  
				
					
						
							
							
								 
						
							
							
								f4e6495b5d 
								
									
								
							
								 
							
						 
						
							
							
								
								Performance improvements and refactor of Ratelimiter ( #7595 )  
							
							... 
							
							
							
							While working on https://github.com/matrix-org/synapse/issues/5665  I found myself digging into the `Ratelimiter` class and seeing that it was both:
* Rather undocumented, and
* causing a *lot* of config checks
This PR attempts to refactor and comment the `Ratelimiter` class, as well as encourage config file accesses to only be done at instantiation. 
Best to be reviewed commit-by-commit. 
							
						 
						
							2020-06-05 10:47:20 +01:00  
				
					
						
							
							
								 
						
							
							
								9481707a52 
								
									
								
							
								 
							
						 
						
							
							
								
								Fixes to the federation rate limiter ( #5621 )  
							
							... 
							
							
							
							- Put the default window_size back to 1000ms (broken by #5181 )
- Make the `rc_federation` config actually do something
- fix an off-by-one error in the 'concurrent' limit
- Avoid creating an unused `_PerHostRatelimiter` object for every single
  incoming request 
							
						 
						
							2019-07-05 11:10:19 +01:00  
				
					
						
							
							
								 
						
							
							
								463b072b12 
								
									
								
							
								 
							
						 
						
							
							
								
								Move logging utilities out of the side drawer of util/ and into logging/ ( #5606 )  
							
							
							
						 
						
							2019-07-04 00:07:04 +10:00  
				
					
						
							
							
								 
						
							
							
								32e7c9e7f2 
								
									
								
							
								 
							
						 
						
							
							
								
								Run Black. ( #5482 )  
							
							
							
						 
						
							2019-06-20 19:32:02 +10:00  
				
					
						
							
							
								 
						
							
							
								f1e5b41388 
								
									
								
							
								 
							
						 
						
							
							
								
								Make all the rate limiting options more consistent ( #5181 )  
							
							
							
						 
						
							2019-05-15 12:06:04 -05:00  
				
					
						
							
							
								 
						
							
							
								33b40d0a25 
								
							
								 
							
						 
						
							
							
								
								Make FederationRateLimiter queue requests properly  
							
							... 
							
							
							
							popitem removes the *most recent* item by default [1]. We want the oldest.
Fixes  #3524 
[1]: https://docs.python.org/2/library/collections.html#collections.OrderedDict.popitem  
							
						 
						
							2018-07-13 16:19:40 +01:00  
				
					
						
							
							
								 
						
							
							
								49af402019 
								
							
								 
							
						 
						
							
							
								
								run isort  
							
							
							
						 
						
							2018-07-09 16:09:20 +10:00  
				
					
						
							
							
								 
						
							
							
								77ac14b960 
								
									
								
							
								 
							
						 
						
							
							
								
								Pass around the reactor explicitly ( #3385 )  
							
							
							
						 
						
							2018-06-22 09:37:10 +01:00  
				
					
						
							
							
								 
						
							
							
								a7fe62f0cb 
								
							
								 
							
						 
						
							
							
								
								Fix logcontext leaks in rate limiter  
							
							
							
						 
						
							2018-05-03 12:31:59 +01:00  
				
					
						
							
							
								 
						
							
							
								2a13af23bc 
								
							
								 
							
						 
						
							
							
								
								Use run_in_background in preference to preserve_fn  
							
							... 
							
							
							
							While I was going through uses of preserve_fn for other PRs, I converted places
which only use the wrapped function once to use run_in_background, to avoid
creating the function object. 
							
						 
						
							2018-04-27 12:55:51 +01:00  
				
					
						
							
							
								 
						
							
							
								7e2f971c08 
								
							
								 
							
						 
						
							
							
								
								Remove some unused functions ( #711 )  
							
							... 
							
							
							
							* Remove some unused functions
* get_room_events_stream is only used in tests
* is_exclusive_room might actually be something we want 
							
						 
						
							2016-04-08 14:01:56 +01:00  
				
					
						
							
							
								 
						
							
							
								2c1fbea531 
								
							
								 
							
						 
						
							
							
								
								Fix up logcontexts  
							
							
							
						 
						
							2016-02-08 14:26:45 +00:00  
				
					
						
							
							
								 
						
							
							
								d83d004ccd 
								
							
								 
							
						 
						
							
							
								
								Fix flake8 warnings for new flake8  
							
							
							
						 
						
							2016-02-02 17:18:50 +00:00  
				
					
						
							
							
								 
						
							
							
								6c28ac260c 
								
							
								 
							
						 
						
							
							
								
								copyrights  
							
							
							
						 
						
							2016-01-07 04:26:29 +00:00  
				
					
						
							
							
								 
						
							
							
								3077cb2915 
								
							
								 
							
						 
						
							
							
								
								Use contextlib.contextmanager instead of a custom class  
							
							
							
						 
						
							2015-03-02 13:32:44 +00:00  
				
					
						
							
							
								 
						
							
							
								0554d07082 
								
							
								 
							
						 
						
							
							
								
								Move federation rate limiting out of transport layer  
							
							
							
						 
						
							2015-02-27 15:41:52 +00:00