If null, return default partition during create

This commit is contained in:
Tadgh 2021-05-04 16:22:01 -04:00
parent fcc662da79
commit 0fb0419a67
2 changed files with 7 additions and 2 deletions

View File

@ -29,8 +29,8 @@ import javax.annotation.Nullable;
public interface IRequestPartitionHelperSvc {
@Nonnull
RequestPartitionId determineReadPartitionForRequest(RequestDetails theRequest, String theResourceType);
RequestPartitionId determineReadPartitionForRequest(@Nullable RequestDetails theRequest, String theResourceType);
@Nonnull
RequestPartitionId determineCreatePartitionForRequest(RequestDetails theRequest, @Nonnull IBaseResource theResource, @Nonnull String theResourceType);
RequestPartitionId determineCreatePartitionForRequest(@Nullable RequestDetails theRequest, @Nonnull IBaseResource theResource, @Nonnull String theResourceType);
}

View File

@ -180,6 +180,11 @@ public class RequestPartitionHelperSvc implements IRequestPartitionHelperSvc {
if (myPartitionSettings.isPartitioningEnabled()) {
boolean nonPartitionableResource = myNonPartitionableResourceNames.contains(theResourceType);
//TODO GGG eventually, theRequest will not be allowed to be null here, and we will pass through SystemRequestDetails instead.
if (theRequest == null && nonPartitionableResource) {
return RequestPartitionId.defaultPartition();
}
if (theRequest instanceof SystemRequestDetails) {
requestPartitionId = getSystemRequestPartitionId(theRequest, nonPartitionableResource);
} else {