Skip to content

Commit

Permalink
Update changelog and clean cache when group is updated (#2479)
Browse files Browse the repository at this point in the history
* Update changelog when group is updated

* Remove from store cache when updated
  • Loading branch information
ruhan1 authored Nov 19, 2024
1 parent 4ede79c commit 02dd94c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -493,7 +494,12 @@ protected Boolean doStore( StoreKey k, ArtifactStore store, ChangeSummary summar
return false;
}

logger.debug( "Put {} to stores map", k );
logger.info( "Put {} to stores, {}", k, summary );
if ( summary != null )
{
store.setMetadata( ArtifactStore.METADATA_CHANGELOG,
String.format( "%s, %s", summary.getSummary(), new Date() ));
}
final ArtifactStore old = putArtifactStoreInternal( store.getKey(), store );

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static org.commonjava.indy.db.common.StoreUpdateAction.STORE;
import static org.commonjava.indy.model.core.StoreType.hosted;

@SuppressWarnings( "unchecked" )
Expand Down Expand Up @@ -415,6 +416,17 @@ protected Indy getIndyClient()
return this.client;
}

@Override
protected void postStore( final ArtifactStore store, final ArtifactStore original, final ChangeSummary summary,
final boolean exists, final boolean fireEvents, final EventMetadata eventMetadata )
throws IndyDataException
{
super.postStore( store, original, summary, exists, fireEvents, eventMetadata );
logger.info( "Remove from store cache, {}", store.getKey() );
BasicCacheHandle<StoreKey, ArtifactStore> cache = cacheProducer.getBasicCache( ARTIFACT_STORE );
cache.remove( store.getKey() );
}

private ArtifactStore computeIfAbsent( StoreKey key, Supplier<ArtifactStore> storeProvider, int expirationMins,
boolean forceQuery )
{
Expand Down

0 comments on commit 02dd94c

Please sign in to comment.