File tree 2 files changed +5
-1
lines changed 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ def status():
70
70
'secure-mode-hash' ,
71
71
'tags' ,
72
72
'migrations' ,
73
+ 'event-gzip' ,
73
74
'event-sampling' ,
74
75
'polling-gzip' ,
75
76
'inline-context' ,
Original file line number Diff line number Diff line change 12
12
import uuid
13
13
import queue
14
14
import urllib3
15
+ import gzip
15
16
from ldclient .config import Config
16
17
from datetime import timedelta
17
18
from random import Random
@@ -559,19 +560,21 @@ def _post_events_with_retry(
559
560
):
560
561
hdrs = _headers (config )
561
562
hdrs ['Content-Type' ] = 'application/json'
563
+ hdrs ['Content-Encoding' ] = 'gzip'
562
564
if payload_id :
563
565
hdrs ['X-LaunchDarkly-Event-Schema' ] = str (__CURRENT_EVENT_SCHEMA__ )
564
566
hdrs ['X-LaunchDarkly-Payload-ID' ] = payload_id
565
567
can_retry = True
566
568
context = "posting %s" % events_description
569
+ data = gzip .compress (bytes (body , 'utf-8' ))
567
570
while True :
568
571
next_action_message = "will retry" if can_retry else "some events were dropped"
569
572
try :
570
573
r = http_client .request (
571
574
'POST' ,
572
575
uri ,
573
576
headers = hdrs ,
574
- body = body ,
577
+ body = data ,
575
578
timeout = urllib3 .Timeout (connect = config .http .connect_timeout , read = config .http .read_timeout ),
576
579
retries = 0
577
580
)
You can’t perform that action at this time.
0 commit comments