Skip to content

Commit 02dd94c

Browse files
authored
Update changelog and clean cache when group is updated (#2479)
* Update changelog when group is updated * Remove from store cache when updated
1 parent 4ede79c commit 02dd94c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

db/common/src/main/java/org/commonjava/indy/db/common/AbstractStoreDataManager.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import java.util.ArrayList;
4747
import java.util.Collection;
4848
import java.util.Collections;
49+
import java.util.Date;
4950
import java.util.HashSet;
5051
import java.util.List;
5152
import java.util.Map;
@@ -493,7 +494,12 @@ protected Boolean doStore( StoreKey k, ArtifactStore store, ChangeSummary summar
493494
return false;
494495
}
495496

496-
logger.debug( "Put {} to stores map", k );
497+
logger.info( "Put {} to stores, {}", k, summary );
498+
if ( summary != null )
499+
{
500+
store.setMetadata( ArtifactStore.METADATA_CHANGELOG,
501+
String.format( "%s, %s", summary.getSummary(), new Date() ));
502+
}
497503
final ArtifactStore old = putArtifactStoreInternal( store.getKey(), store );
498504

499505
try

db/service/src/main/java/org/commonjava/indy/db/service/ServiceStoreDataManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555

5656
import static java.util.Collections.emptyMap;
5757
import static java.util.Collections.emptySet;
58+
import static org.commonjava.indy.db.common.StoreUpdateAction.STORE;
5859
import static org.commonjava.indy.model.core.StoreType.hosted;
5960

6061
@SuppressWarnings( "unchecked" )
@@ -415,6 +416,17 @@ protected Indy getIndyClient()
415416
return this.client;
416417
}
417418

419+
@Override
420+
protected void postStore( final ArtifactStore store, final ArtifactStore original, final ChangeSummary summary,
421+
final boolean exists, final boolean fireEvents, final EventMetadata eventMetadata )
422+
throws IndyDataException
423+
{
424+
super.postStore( store, original, summary, exists, fireEvents, eventMetadata );
425+
logger.info( "Remove from store cache, {}", store.getKey() );
426+
BasicCacheHandle<StoreKey, ArtifactStore> cache = cacheProducer.getBasicCache( ARTIFACT_STORE );
427+
cache.remove( store.getKey() );
428+
}
429+
418430
private ArtifactStore computeIfAbsent( StoreKey key, Supplier<ArtifactStore> storeProvider, int expirationMins,
419431
boolean forceQuery )
420432
{

0 commit comments

Comments
 (0)