We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a380f48 commit 8e3f385Copy full SHA for 8e3f385
lib/github_authentication/provider.rb
@@ -1,28 +1,25 @@
1
# frozen_string_literal: true
2
-require "mutex_m.rb"
3
-
4
require 'github_authentication/retriable'
5
6
module GithubAuthentication
7
class Provider
8
include Retriable
9
- include Mutex_m
10
11
Error = Class.new(StandardError)
12
TokenGeneratorError = Class.new(Error)
13
14
def initialize(generator:, cache:)
15
- super()
16
@token = nil
17
@generator = generator
18
@cache = cache
+ @mutex = Mutex.new
19
end
20
21
def token(seconds_ttl: 5 * 60)
22
return @token if @token&.valid_for?(seconds_ttl)
23
24
with_retries(TokenGeneratorError) do
25
- mu_synchronize do
+ @mutex.synchronize do
26
27
28
if (@token = @cache.read)
0 commit comments