Skip to content

Commit b06b05f

Browse files
committed
use AzSessions 1.2 time offset
1 parent a78ad2f commit b06b05f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name = "AzStorage"
22
uuid = "c6697862-1611-5eae-9ef8-48803c85c8d6"
3-
version = "1.5.1"
3+
version = "1.6.0"
44

55
[deps]
66
AbstractStorage = "14dbef02-f468-5f15-853e-5ec8dee7b899"
77
AzSessions = "f239b30d-ae6b-58be-a2d5-7e9f30e280a9"
88
AzStorage_jll = "00c928b4-b5f3-54d8-b38d-afd4635c4ad2"
99
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
10+
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
1011
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
1112
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
1213
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
@@ -15,17 +16,16 @@ Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
1516

1617
[compat]
1718
AbstractStorage = "^1.1"
18-
AzSessions = "1"
19+
AzSessions = "^1.2"
1920
AzStorage_jll = "0.4"
2021
HTTP = "0.8, 0.9"
2122
LightXML = "0.9"
2223
julia = "^1.6"
2324

2425
[extras]
25-
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
2626
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
2727
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2828
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2929

3030
[targets]
31-
test = ["Dates", "JSON", "Random", "Test"]
31+
test = ["JSON", "Random", "Test"]

src/AzStorage.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module AzStorage
22

3-
using AbstractStorage, AzSessions, AzStorage_jll, Base64, DelimitedFiles, HTTP, LightXML, Serialization, Sockets
3+
using AbstractStorage, AzSessions, AzStorage_jll, Base64, Dates, DelimitedFiles, HTTP, LightXML, Serialization, Sockets
44

55
# https://docs.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes
66
const RETRYABLE_HTTP_ERRORS = [
@@ -244,7 +244,8 @@ function writebytes(c::AzContainer, o::AbstractString, data::DenseArray{UInt8};
244244
end
245245

246246
function writebytes_block(c, o, data, _nblocks)
247-
t = token(c.session)
247+
# heuristic to increase probability that token is valid during the retry logic in AzSessions.c
248+
t = token(c.session; offset=Minute(30))
248249
l = ceil(Int, log10(_nblocks))
249250
blockids = [base64encode(lpad(blockid-1, l, '0')) for blockid in 1:_nblocks]
250251
_blockids = [HTTP.escapeuri(blockid) for blockid in blockids]
@@ -412,7 +413,8 @@ function readbytes!(c::AzContainer, o::AbstractString, data::DenseArray{UInt8};
412413
end
413414

414415
function readbytes_threaded!(c, o, data, offset, _nthreads)
415-
t = token(c.session)
416+
# heuristic to increase probability that token is valid during the retry logic in AzSessions.c
417+
t = token(c.session; offset=Minute(30))
416418
r = ccall((:curl_readbytes_retry_threaded, libAzStorage), ResponseCodes,
417419
(Cstring, Cstring, Cstring, Cstring, Ptr{UInt8}, Csize_t, Csize_t, Cint, Cint, Cint),
418420
t, c.storageaccount, c.containername, addprefix(c,o), data, offset, length(data), _nthreads, c.nretry, c.verbose)

0 commit comments

Comments
 (0)