Added cacheSize in ReserveCache API request (#1044)
* Added cacheSize in ReserveCache API request * minor * minor * minor * Cleanup * package-lock revert * Modified tests * New Response Type * cleanup * Linting * Lint fix * Resolved comments * Added tests * package-lock * Resolved package-lock mismatch * Liniting * Update packages/cache/src/cache.ts Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com> * Linting issue * Resolved few comments * version upgrade * Savecache tests * RequestUtil test * test * test * test * test * test * test * test * test * test * test Co-authored-by: Apple <apple@Apples-MacBook-Pro.local> Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
This commit is contained in:
+6
-4
@@ -13,7 +13,8 @@ import {
|
||||
InternalCacheOptions,
|
||||
CommitCacheRequest,
|
||||
ReserveCacheRequest,
|
||||
ReserveCacheResponse
|
||||
ReserveCacheResponse,
|
||||
ITypedResponseWithError
|
||||
} from './contracts'
|
||||
import {downloadCacheHttpClient, downloadCacheStorageSDK} from './downloadUtils'
|
||||
import {
|
||||
@@ -143,13 +144,14 @@ export async function reserveCache(
|
||||
key: string,
|
||||
paths: string[],
|
||||
options?: InternalCacheOptions
|
||||
): Promise<number> {
|
||||
): Promise<ITypedResponseWithError<ReserveCacheResponse>> {
|
||||
const httpClient = createHttpClient()
|
||||
const version = getCacheVersion(paths, options?.compressionMethod)
|
||||
|
||||
const reserveCacheRequest: ReserveCacheRequest = {
|
||||
key,
|
||||
version
|
||||
version,
|
||||
cacheSize: options?.cacheSize
|
||||
}
|
||||
const response = await retryTypedResponse('reserveCache', async () =>
|
||||
httpClient.postJson<ReserveCacheResponse>(
|
||||
@@ -157,7 +159,7 @@ export async function reserveCache(
|
||||
reserveCacheRequest
|
||||
)
|
||||
)
|
||||
return response?.result?.cacheId ?? -1
|
||||
return response
|
||||
}
|
||||
|
||||
function getContentRange(start: number, end: number): string {
|
||||
|
||||
Reference in New Issue
Block a user