@@ -21,41 +21,45 @@ module ReadRaw =
21
21
( startPositionInclusive : StartPosition )
22
22
( msgCount : int )
23
23
: Async < ReadAllPage > =
24
- async.Delay( fun () ->
25
- match readingDirection with
26
- | ReadingDirection.Forward ->
27
- store.ReadAllForwards( fromStartPositionInclusive startPositionInclusive, msgCount)
28
- | ReadingDirection.Backward ->
29
- store.ReadAllBackwards( fromStartPositionInclusive startPositionInclusive, msgCount)
30
- |> Async.AwaitTask)
24
+ async {
25
+ return ! match readingDirection with
26
+ | ReadingDirection.Forward ->
27
+ store.ReadAllForwards( fromStartPositionInclusive startPositionInclusive, msgCount)
28
+ | ReadingDirection.Backward ->
29
+ store.ReadAllBackwards( fromStartPositionInclusive startPositionInclusive, msgCount)
30
+ |> Async.awaitTaskWithInnerException
31
+ }
31
32
32
33
let readFromStream ( store : SqlStreamStore.IStreamStore )
33
34
( readingDirection : ReadingDirection )
34
35
( streamName : string )
35
36
( readVersion : ReadVersion )
36
37
( msgCount : int )
37
38
: Async < ReadStreamPage > =
38
- async.Delay( fun () ->
39
- match readingDirection with
40
- | ReadingDirection.Forward ->
41
- store.ReadStreamForwards( StreamId( streamName), fromReadVersion readVersion, msgCount)
42
- | ReadingDirection.Backward ->
43
- store.ReadStreamBackwards( StreamId( streamName), fromReadVersion readVersion, msgCount)
44
- |> Async.AwaitTask)
39
+ async {
40
+ return ! match readingDirection with
41
+ | ReadingDirection.Forward ->
42
+ store.ReadStreamForwards( StreamId( streamName), fromReadVersion readVersion, msgCount)
43
+ | ReadingDirection.Backward ->
44
+ store.ReadStreamBackwards( StreamId( streamName), fromReadVersion readVersion, msgCount)
45
+ |> Async.awaitTaskWithInnerException
46
+ }
45
47
46
48
let readFromAllStream ' ( store : SqlStreamStore.IStreamStore )
47
49
( readingDirection : ReadingDirection )
48
50
( startPositionInclusive : StartPosition )
49
51
( msgCount : int )
50
52
( prefetchJson : bool )
51
53
: Async < ReadAllPage > =
52
- async.Delay( fun () ->
53
- match readingDirection with
54
- | ReadingDirection.Forward ->
55
- store.ReadAllForwards( fromStartPositionInclusive startPositionInclusive, msgCount, prefetchJson)
56
- | ReadingDirection.Backward ->
57
- store.ReadAllBackwards( fromStartPositionInclusive startPositionInclusive, msgCount, prefetchJson)
58
- |> Async.AwaitTask)
54
+ async {
55
+ return ! match readingDirection with
56
+ | ReadingDirection.Forward ->
57
+ store.ReadAllForwards( fromStartPositionInclusive startPositionInclusive, msgCount, prefetchJson)
58
+ | ReadingDirection.Backward ->
59
+ store.ReadAllBackwards
60
+ ( fromStartPositionInclusive startPositionInclusive, msgCount, prefetchJson)
61
+ |> Async.awaitTaskWithInnerException
62
+ }
59
63
60
64
let readFromStream ' ( store : SqlStreamStore.IStreamStore )
61
65
( readingDirection : ReadingDirection )
@@ -64,13 +68,16 @@ module ReadRaw =
64
68
( msgCount : int )
65
69
( prefetchJson : bool )
66
70
: Async < ReadStreamPage > =
67
- async.Delay( fun () ->
68
- match readingDirection with
69
- | ReadingDirection.Forward ->
70
- store.ReadStreamForwards( StreamId( streamName), fromReadVersion readVersion, msgCount, prefetchJson)
71
- | ReadingDirection.Backward ->
72
- store.ReadStreamBackwards( StreamId( streamName), fromReadVersion readVersion, msgCount, prefetchJson)
73
- |> Async.AwaitTask)
71
+ async {
72
+ return ! match readingDirection with
73
+ | ReadingDirection.Forward ->
74
+ store.ReadStreamForwards
75
+ ( StreamId( streamName), fromReadVersion readVersion, msgCount, prefetchJson)
76
+ | ReadingDirection.Backward ->
77
+ store.ReadStreamBackwards
78
+ ( StreamId( streamName), fromReadVersion readVersion, msgCount, prefetchJson)
79
+ |> Async.awaitTaskWithInnerException
80
+ }
74
81
75
82
let readFromAllStream '' ( store : SqlStreamStore.IStreamStore )
76
83
( readingDirection : ReadingDirection )
@@ -79,15 +86,22 @@ module ReadRaw =
79
86
( prefetchJson : bool )
80
87
( cancellationToken : CancellationToken )
81
88
: Async < ReadAllPage > =
82
- async.Delay( fun () ->
83
- match readingDirection with
84
- | ReadingDirection.Forward ->
85
- store.ReadAllForwards
86
- ( fromStartPositionInclusive startPositionInclusive, msgCount, prefetchJson, cancellationToken)
87
- | ReadingDirection.Backward ->
88
- store.ReadAllBackwards
89
- ( fromStartPositionInclusive startPositionInclusive, msgCount, prefetchJson, cancellationToken)
90
- |> Async.AwaitTask)
89
+ async {
90
+ return ! match readingDirection with
91
+ | ReadingDirection.Forward ->
92
+ store.ReadAllForwards
93
+ ( fromStartPositionInclusive startPositionInclusive,
94
+ msgCount,
95
+ prefetchJson,
96
+ cancellationToken)
97
+ | ReadingDirection.Backward ->
98
+ store.ReadAllBackwards
99
+ ( fromStartPositionInclusive startPositionInclusive,
100
+ msgCount,
101
+ prefetchJson,
102
+ cancellationToken)
103
+ |> Async.awaitTaskWithInnerException
104
+ }
91
105
92
106
let readFromStream '' ( store : SqlStreamStore.IStreamStore )
93
107
( readingDirection : ReadingDirection )
@@ -97,12 +111,21 @@ module ReadRaw =
97
111
( prefetchJson : bool )
98
112
( cancellationToken : CancellationToken )
99
113
: Async < ReadStreamPage > =
100
- async.Delay( fun () ->
101
- match readingDirection with
102
- | ReadingDirection.Forward ->
103
- store.ReadStreamForwards
104
- ( StreamId( streamName), fromReadVersion readVersion, msgCount, prefetchJson, cancellationToken)
105
- | ReadingDirection.Backward ->
106
- store.ReadStreamBackwards
107
- ( StreamId( streamName), fromReadVersion readVersion, msgCount, prefetchJson, cancellationToken)
108
- |> Async.AwaitTask)
114
+ async {
115
+ return ! match readingDirection with
116
+ | ReadingDirection.Forward ->
117
+ store.ReadStreamForwards
118
+ ( StreamId( streamName),
119
+ fromReadVersion readVersion,
120
+ msgCount,
121
+ prefetchJson,
122
+ cancellationToken)
123
+ | ReadingDirection.Backward ->
124
+ store.ReadStreamBackwards
125
+ ( StreamId( streamName),
126
+ fromReadVersion readVersion,
127
+ msgCount,
128
+ prefetchJson,
129
+ cancellationToken)
130
+ |> Async.awaitTaskWithInnerException
131
+ }
0 commit comments