Skip to content

Commit

Permalink
fix: fix for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Apr 19, 2024
1 parent 9f26045 commit 9b45ece
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/io/supertokens/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ private void init() throws IOException, StorageQueryException {
// load all configs for each of the tenants.
MultitenancyHelper.getInstance(this).loadConfig(new ArrayList<>());

// we want to load storage layer once again so that the base storage also contains the right
// tenant identifier set passed to the init. So we close the base storage layer and also clear
// all the resources for storage layer
StorageLayer.getBaseStorage(this).stopLogging();
StorageLayer.getBaseStorage(this).close();
this.getResourceDistributor().clearAllResourcesWithResourceKey(StorageLayer.RESOURCE_KEY);
if (!StorageLayer.isInMemDb(this)) {
// we want to load storage layer once again so that the base storage also contains the right
// tenant identifier set passed to the init. So we close the base storage layer and also clear
// all the resources for storage layer
StorageLayer.getBaseStorage(this).stopLogging();
StorageLayer.getBaseStorage(this).close();
this.getResourceDistributor().clearAllResourcesWithResourceKey(StorageLayer.RESOURCE_KEY);
}

MultitenancyHelper.getInstance(this).loadStorageLayer();
} catch (InvalidConfigException e) {
Expand Down

0 comments on commit 9b45ece

Please sign in to comment.