@@ -748,6 +748,7 @@ def __init__(self, app):
748
748
'GCLOUD_PROJECT environment variable.' )
749
749
self ._fcm_url = _MessagingService .FCM_URL .format (project_id )
750
750
self ._client = _http_client .JsonHttpClient (credential = app .credential .get_credential ())
751
+ self ._timeout = app .options .get ('httpTimeout' )
751
752
752
753
@classmethod
753
754
def encode_message (cls , message ):
@@ -757,10 +758,11 @@ def encode_message(cls, message):
757
758
758
759
def send (self , message , dry_run = False ):
759
760
data = {'message' : _MessagingService .encode_message (message )}
761
+ import ipdb ; ipdb .set_trace ()
760
762
if dry_run :
761
763
data ['validate_only' ] = True
762
764
try :
763
- resp = self ._client .body ('post' , url = self ._fcm_url , json = data )
765
+ resp = self ._client .body ('post' , url = self ._fcm_url , json = data , timeout = self . _timeout )
764
766
except requests .exceptions .RequestException as error :
765
767
if error .response is not None :
766
768
self ._handle_fcm_error (error )
@@ -791,7 +793,12 @@ def make_topic_management_request(self, tokens, topic, operation):
791
793
url = '{0}/{1}' .format (_MessagingService .IID_URL , operation )
792
794
try :
793
795
resp = self ._client .body (
794
- 'post' , url = url , json = data , headers = _MessagingService .IID_HEADERS )
796
+ 'post' ,
797
+ url = url ,
798
+ json = data ,
799
+ headers = _MessagingService .IID_HEADERS ,
800
+ timeout = self ._timeout
801
+ )
795
802
except requests .exceptions .RequestException as error :
796
803
if error .response is not None :
797
804
self ._handle_iid_error (error )
0 commit comments