Skip to content

Commit 51212f2

Browse files
authored
Merge pull request #103 from rkyrychuk/master
Cache authorizer to avoid IO end
2 parents a296342 + 03334b8 commit 51212f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/fcm.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,11 @@ def validate_condition_topics?(condition)
320320

321321
def jwt_token
322322
scope = "https://www.googleapis.com/auth/firebase.messaging"
323-
authorizer = Google::Auth::ServiceAccountCredentials.make_creds(
323+
@authorizer ||= Google::Auth::ServiceAccountCredentials.make_creds(
324324
json_key_io: json_key,
325325
scope: scope,
326326
)
327-
token = authorizer.fetch_access_token!
327+
token = @authorizer.fetch_access_token!
328328
token["access_token"]
329329
end
330330

0 commit comments

Comments
 (0)