Skip to content

Commit

Permalink
fix: cron (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc authored Oct 4, 2024
1 parent df6d395 commit 21c8d15
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import io.supertokens.Main;
import io.supertokens.cronjobs.CronTask;
import io.supertokens.cronjobs.CronTaskTest;
import io.supertokens.pluginInterface.STORAGE_TYPE;
import io.supertokens.pluginInterface.Storage;
import io.supertokens.pluginInterface.StorageUtils;
import io.supertokens.pluginInterface.multitenancy.AppIdentifier;
import io.supertokens.pluginInterface.multitenancy.TenantIdentifier;
import io.supertokens.pluginInterface.oauth.OAuthStorage;
import io.supertokens.storageLayer.StorageLayer;

public class CleanupOAuthRevokeListAndChallenges extends CronTask {

Expand All @@ -29,6 +28,10 @@ public static CleanupOAuthRevokeListAndChallenges init(Main main, List<List<Tena

@Override
protected void doTaskPerStorage(Storage storage) throws Exception {
if (storage.getType() != STORAGE_TYPE.SQL) {
return;
}

OAuthStorage oauthStorage = StorageUtils.getOAuthStorage(storage);
oauthStorage.cleanUpExpiredAndRevokedOAuthTokensList();
oauthStorage.deleteOAuthLogoutChallengesBefore(System.currentTimeMillis() - 1000 * 60 * 60 * 48);
Expand Down

0 comments on commit 21c8d15

Please sign in to comment.