@@ -115,6 +115,11 @@ public static boolean executePublish(Collection collection, CollectionReader col
115
115
boolean success = false ;
116
116
final String collectionId = collection .getDescription ().getId ();
117
117
118
+ Future <Boolean > staticFilesPublishingFuture = null ;
119
+ if (CMSFeatureFlags .cmsFeatureFlags ().isStaticFilesPublishingEnabled ()) {
120
+ staticFilesPublishingFuture = performStaticFilesPublish (collection );
121
+ }
122
+
118
123
Future <ImageServicePublishingResult > imageFuture = null ;
119
124
if (CMSFeatureFlags .cmsFeatureFlags ().isImagePublishingEnabled ()) {
120
125
imageFuture = publishImages (collection );
@@ -139,11 +144,13 @@ public static boolean executePublish(Collection collection, CollectionReader col
139
144
140
145
if (CMSFeatureFlags .cmsFeatureFlags ().isStaticFilesPublishingEnabled ()) {
141
146
try {
142
- staticFilesServiceSupplier .getService ().publishCollection (collection );
143
- success &= true ;
147
+ if (staticFilesPublishingFuture == null ) {
148
+ throw new Exception ("static files publishing future unexpectedly null on completion of publishing" );
149
+ }
150
+ success &= staticFilesPublishingFuture .get ();
144
151
} catch (Exception e ) {
145
152
error ().data ("collectionId" , collectionId ).data ("publishing" , true )
146
- .logException (e , "Exception thrown when performing static file publish()" );
153
+ .logException (e , "Exception thrown when completing static file publish()" );
147
154
success = false ;
148
155
}
149
156
}
@@ -788,6 +795,19 @@ private static Future<ImageServicePublishingResult> publishImages(Collection col
788
795
});
789
796
}
790
797
798
+ private static Future <Boolean > performStaticFilesPublish (Collection collection ) {
799
+ return apiPool .submit (() -> {
800
+ try {
801
+ staticFilesServiceSupplier .getService ().publishCollection (collection );
802
+ return true ;
803
+ } catch (Exception e ) {
804
+ error ().data ("collectionId" , collection .getDescription ().getId ()).data ("publishing" , true )
805
+ .logException (e , "Exception thrown when performing static file publish()" );
806
+ return false ;
807
+ }
808
+ });
809
+ }
810
+
791
811
// Valid CMDDataset uris for published CMD versions of a dataset (edition) -
792
812
// /dataset/{datatsetId}/editions/{edition}/versions/{version}/metadata
793
813
protected static boolean isValidCMDDatasetURI (String uri ) {
0 commit comments