Skip to content

Commit

Permalink
invalidate session via alias
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego committed Jun 28, 2022
1 parent a69acc6 commit 9040699
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ describe('Session index', () => {

expect(mockElasticsearchClient.delete).toHaveBeenCalledTimes(1);
expect(mockElasticsearchClient.delete).toHaveBeenCalledWith(
{ id: 'some-long-sid', index: indexName, refresh: 'wait_for' },
{ id: 'some-long-sid', index: aliasName, refresh: 'wait_for' },
{ ignore: [404], meta: true }
);
});
Expand All @@ -1226,7 +1226,7 @@ describe('Session index', () => {

expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledTimes(1);
expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledWith({
index: indexName,
index: aliasName,
refresh: true,
body: { query: { match_all: {} } },
});
Expand All @@ -1250,7 +1250,7 @@ describe('Session index', () => {

expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledTimes(1);
expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledWith({
index: indexName,
index: aliasName,
refresh: true,
body: { query: { bool: { must: [{ term: { 'provider.type': 'basic' } }] } } },
});
Expand All @@ -1266,7 +1266,7 @@ describe('Session index', () => {

expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledTimes(1);
expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledWith({
index: indexName,
index: aliasName,
refresh: true,
body: {
query: {
Expand All @@ -1291,7 +1291,7 @@ describe('Session index', () => {

expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledTimes(1);
expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledWith({
index: indexName,
index: aliasName,
refresh: true,
body: {
query: {
Expand All @@ -1316,7 +1316,7 @@ describe('Session index', () => {

expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledTimes(1);
expect(mockElasticsearchClient.deleteByQuery).toHaveBeenCalledWith({
index: indexName,
index: aliasName,
refresh: true,
body: {
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class SessionIndex {
// We don't specify primary term and sequence number as delete should always take precedence
// over any updates that could happen in the meantime.
const { statusCode } = await this.options.elasticsearchClient.delete(
{ id: filter.sid, index: this.indexName, refresh: 'wait_for' },
{ id: filter.sid, index: this.aliasName, refresh: 'wait_for' },
{ ignore: [404], meta: true }
);

Expand Down Expand Up @@ -339,7 +339,7 @@ export class SessionIndex {

try {
const response = await this.options.elasticsearchClient.deleteByQuery({
index: this.indexName,
index: this.aliasName,
refresh: true,
body: { query: deleteQuery },
});
Expand Down

0 comments on commit 9040699

Please sign in to comment.