-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #884: clearing the cache of the push client works only on one node (
- Loading branch information
Showing
23 changed files
with
536 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...b/changelog/changesets/powerauth-push-server/1.9.x/20241011-app-credentials-timestamp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd"> | ||
|
||
<changeSet id="1" logicalFilePath="powerauth-push-server/1.9.x/20241011-app-credentials-timestamp.xml" author="Lubos Racansky"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<columnExists tableName="push_app_credentials" columnName="timestamp_created"/> | ||
<columnExists tableName="push_app_credentials" columnName="timestamp_last_updated"/> | ||
</not> | ||
</preConditions> | ||
<comment>Add columns timestamp_last_updated and timestamp_created to push_app_credentials table</comment> | ||
<addColumn tableName="push_app_credentials"> | ||
<column name="timestamp_created" type="timestamp" defaultValueDate="${now}"> | ||
<constraints nullable="false" /> | ||
</column> | ||
<column name="timestamp_last_updated" type="timestamp" /> | ||
</addColumn> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
8 changes: 8 additions & 0 deletions
8
docs/db/changelog/changesets/powerauth-push-server/1.9.x/db.changelog-version.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd"> | ||
|
||
<include file="20241011-app-credentials-timestamp.xml" relativeToChangelogFile="true" /> | ||
|
||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Changeset powerauth-push-server/1.9.x/20241011-app-credentials-timestamp.xml::1::Lubos Racansky | ||
-- Add columns timestamp_last_updated and timestamp_created to push_app_credentials table | ||
ALTER TABLE push_app_credentials ADD timestamp_created datetime2 CONSTRAINT DF_push_app_credentials_timestamp_created DEFAULT GETDATE() NOT NULL; | ||
GO | ||
|
||
ALTER TABLE push_app_credentials ADD timestamp_last_updated datetime2; | ||
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Changeset powerauth-push-server/1.9.x/20241011-app-credentials-timestamp.xml::1::Lubos Racansky | ||
-- Add columns timestamp_last_updated and timestamp_created to push_app_credentials table | ||
ALTER TABLE push_app_credentials ADD timestamp_created TIMESTAMP DEFAULT sysdate NOT NULL; | ||
|
||
ALTER TABLE push_app_credentials ADD timestamp_last_updated TIMESTAMP; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Changeset powerauth-push-server/1.9.x/20241011-app-credentials-timestamp.xml::1::Lubos Racansky | ||
-- Add columns timestamp_last_updated and timestamp_created to push_app_credentials table | ||
ALTER TABLE push_app_credentials ADD timestamp_created TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW() NOT NULL; | ||
|
||
ALTER TABLE push_app_credentials ADD timestamp_last_updated TIMESTAMP WITHOUT TIME ZONE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
powerauth-push-server/src/main/java/io/getlime/push/configuration/CacheConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2024 Wultra s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.getlime.push.configuration; | ||
|
||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
import com.github.benmanes.caffeine.cache.LoadingCache; | ||
import io.getlime.push.service.AppRelatedPushClient; | ||
import io.getlime.push.service.AppRelatedPushClientCacheLoader; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.time.Duration; | ||
|
||
|
||
/** | ||
* Cache configuration. | ||
* | ||
* @author Lubos Racansky, [email protected] | ||
*/ | ||
@Configuration | ||
@Slf4j | ||
public class CacheConfiguration { | ||
|
||
/** | ||
* Configure cache for {@link AppRelatedPushClient}. | ||
* | ||
* @return cache for AppRelatedPushClient | ||
*/ | ||
@Bean | ||
public LoadingCache<String, AppRelatedPushClient> appRelatedPushClientCache( | ||
@Value("${powerauth.push.service.clients.cache.refreshAfterWrite}") final Duration refreshAfterWrite, | ||
final AppRelatedPushClientCacheLoader cacheLoader) { | ||
|
||
logger.info("Initializing AppRelatedPushClient cache with refreshAfterWrite={}", refreshAfterWrite); | ||
return Caffeine.newBuilder() | ||
.refreshAfterWrite(refreshAfterWrite) | ||
.build(cacheLoader); | ||
} | ||
|
||
} |
40 changes: 0 additions & 40 deletions
40
...auth-push-server/src/main/java/io/getlime/push/configuration/StorageMapConfiguration.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.