|
8 | 8 | OpenFeatureEventEmitter, |
9 | 9 | Provider, |
10 | 10 | ProviderEvents, |
11 | | - ProviderStatus, |
12 | 11 | ResolutionDetails, |
13 | 12 | StandardResolutionReasons, |
14 | 13 | TypeMismatchError, |
@@ -66,28 +65,19 @@ export class GoFeatureFlagWebProvider implements Provider { |
66 | 65 | this._dataCollectorHook = new GoFeatureFlagDataCollectorHook(options, logger); |
67 | 66 | } |
68 | 67 |
|
69 | | - // status of the provider |
70 | | - private _status: ProviderStatus = ProviderStatus.NOT_READY; |
71 | | - |
72 | | - get status(): ProviderStatus { |
73 | | - return this._status; |
74 | | - } |
75 | | - |
76 | 68 | async initialize(context: EvaluationContext): Promise<void> { |
77 | 69 | if (!this._disableDataCollection && this._dataCollectorHook) { |
78 | 70 | this.hooks = [this._dataCollectorHook]; |
79 | 71 | this._dataCollectorHook.init(); |
80 | 72 | } |
81 | 73 | return Promise.all([this.fetchAll(context), this.connectWebsocket()]) |
82 | 74 | .then(() => { |
83 | | - this._status = ProviderStatus.READY; |
84 | 75 | this._logger?.debug(`${GoFeatureFlagWebProvider.name}: go-feature-flag provider initialized`); |
85 | 76 | }) |
86 | 77 | .catch((error) => { |
87 | 78 | this._logger?.error( |
88 | 79 | `${GoFeatureFlagWebProvider.name}: initialization failed, provider is on error, we will try to reconnect: ${error}`, |
89 | 80 | ); |
90 | | - this._status = ProviderStatus.ERROR; |
91 | 81 | this.handleFetchErrors(error); |
92 | 82 |
|
93 | 83 | // The initialization of the provider is in a failing state, we unblock the initialize method, |
@@ -254,10 +244,8 @@ export class GoFeatureFlagWebProvider implements Provider { |
254 | 244 | attempt++; |
255 | 245 | try { |
256 | 246 | await this.fetchAll(ctx, flagsChanged); |
257 | | - this._status = ProviderStatus.READY; |
258 | 247 | return; |
259 | 248 | } catch (err) { |
260 | | - this._status = ProviderStatus.ERROR; |
261 | 249 | this.handleFetchErrors(err); |
262 | 250 | await new Promise((resolve) => setTimeout(resolve, delay)); |
263 | 251 | delay *= this._retryDelayMultiplier; |
|
0 commit comments