|
161 | 161 | %% flow | noflow, see rabbitmq-server#114 |
162 | 162 | delivery_flow, |
163 | 163 | interceptor_state, |
164 | | - authz_context |
| 164 | + authz_context, |
| 165 | + %% defines how ofter gc will be executed |
| 166 | + gc_threshold |
165 | 167 | }). |
166 | 168 |
|
167 | 169 |
|
@@ -456,6 +458,7 @@ init([Channel, ReaderPid, WriterPid, ConnPid, ConnName, Protocol, User, VHost, |
456 | 458 | Limiter0 |
457 | 459 | end, |
458 | 460 | OptionalVariables = extract_topic_variable_map_from_amqp_params(AmqpParams), |
| 461 | + {ok, GCThreshold} = application:get_env(rabbit, gc_threshold), |
459 | 462 | State = #ch{state = starting, |
460 | 463 | protocol = Protocol, |
461 | 464 | channel = Channel, |
@@ -488,7 +491,8 @@ init([Channel, ReaderPid, WriterPid, ConnPid, ConnName, Protocol, User, VHost, |
488 | 491 | reply_consumer = none, |
489 | 492 | delivery_flow = Flow, |
490 | 493 | interceptor_state = undefined, |
491 | | - authz_context = OptionalVariables}, |
| 494 | + authz_context = OptionalVariables, |
| 495 | + gc_threshold = GCThreshold}, |
492 | 496 | State1 = State#ch{ |
493 | 497 | interceptor_state = rabbit_channel_interceptor:init(State)}, |
494 | 498 | State2 = rabbit_event:init_stats_timer(State1, #ch.stats_timer), |
@@ -931,8 +935,8 @@ extract_topic_variable_map_from_amqp_params([Value]) -> |
931 | 935 | extract_topic_variable_map_from_amqp_params(_) -> |
932 | 936 | #{}. |
933 | 937 |
|
934 | | -check_msg_size(Content) -> |
935 | | - Size = rabbit_basic:maybe_gc_large_msg(Content), |
| 938 | +check_msg_size(Content, GCThreshold) -> |
| 939 | + Size = rabbit_basic:maybe_gc_large_msg(Content, GCThreshold), |
936 | 940 | case Size > ?MAX_MSG_SIZE of |
937 | 941 | true -> precondition_failed("message size ~B larger than max size ~B", |
938 | 942 | [Size, ?MAX_MSG_SIZE]); |
@@ -1118,8 +1122,9 @@ handle_method(#'basic.publish'{exchange = ExchangeNameBin, |
1118 | 1122 | user = #user{username = Username} = User, |
1119 | 1123 | conn_name = ConnName, |
1120 | 1124 | delivery_flow = Flow, |
1121 | | - authz_context = AuthzContext}) -> |
1122 | | - check_msg_size(Content), |
| 1125 | + authz_context = AuthzContext, |
| 1126 | + gc_threshold = GCThreshold}) -> |
| 1127 | + check_msg_size(Content, GCThreshold), |
1123 | 1128 | ExchangeName = rabbit_misc:r(VHostPath, exchange, ExchangeNameBin), |
1124 | 1129 | check_write_permitted(ExchangeName, User), |
1125 | 1130 | Exchange = rabbit_exchange:lookup_or_die(ExchangeName), |
|
0 commit comments