Skip to content

BUG: deduplicateRefresh config does not work with concurrent refreshing #307

Description

@AndrewBoklashko

Problem

For two concurrent requests expected behavior should be

deduplicateRefresh: true:

  • first 401 starts refresh
  • second 401 waits for same refresh promise
  • both requests retry after refresh and succeed (refresh is deduplicated)

deduplicateRefresh: false:

  • first 401 starts refresh 1
  • second 401 starts refresh 2
  • both requests retry after refresh and succeed (refresh is not deduplicated)

But the actual behavior is:
deduplicateRefresh: true:

  • first 401 starts refresh
  • second 401 fails with an error
  • only first request retries after refresh and succeeds (failure)

deduplicateRefresh: false:

  • first 401 starts refresh
  • second 401 waits for same refresh promise
  • both requests retry after refresh and succeed (but refresh is deduplicated despite the config is false)

Reproduction with test cases

https://prod.liveshare.vsengsaas.visualstudio.com/join?E765E2576D733837A79E2CC12393593F2D40
https://stackblitz.com/edit/stackblitz-starters-a59mj95e?file=package.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions