Commit e3eab78
authored
feat: use SSE in forc-publish for long-running uploads (#7178)
This pull request introduces changes to enhance the functionality of the
`forc-publish` plugin, including improvements to error handling, support
for streaming server responses, and updates to dependencies. The most
significant changes include adding a new error variant, updating the
`upload` method to handle streaming responses, and modifying
dependencies to include `futures-util` and additional features for
`reqwest`.
### Enhancements to Error Handling:
* Added a new `ServerError` variant to the `Error` enum in
`forc-plugins/forc-publish/src/error.rs` to handle server-related
errors.
### Improvements to `upload` Method:
* Updated the `upload` method in `forc-publish/src/forc_pub_client.rs`
to process streaming server responses using `futures-util::StreamExt`.
This includes handling chunked data, parsing JSON responses, and
printing event updates.
[[1]](diffhunk://#diff-c706a808124a73081593a5e34fb999aa1a446f97d97da1657ddb4b3c55d24371R43)
[[2]](diffhunk://#diff-c706a808124a73081593a5e34fb999aa1a446f97d97da1657ddb4b3c55d24371L53-R97)
### Dependency Updates:
* Added `futures-util` as a dependency in `Cargo.toml` and
`forc-plugins/forc-publish/Cargo.toml` to support streaming operations.
[[1]](diffhunk://#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542R157)
[[2]](diffhunk://#diff-2bd34a7b1fa0f1850ad25c6e080d410b2df98c16b6cd75445a138d04e617311aL16-R17)
* Enabled the `stream` feature for `reqwest` in
`forc-plugins/forc-publish/Cargo.toml` to facilitate streaming server
responses.
### Minor Adjustments:
* Added empty `println!` calls in `main.rs` to improve output formatting
during error handling and publishing operations.
[[1]](diffhunk://#diff-2c9e261f1e02238f33a9403387f40481b5b372475c0de3782146b614210675b3R32)
[[2]](diffhunk://#diff-2c9e261f1e02238f33a9403387f40481b5b372475c0de3782146b614210675b3R52)
1 parent a428376 commit e3eab78
File tree
6 files changed
+93
-14
lines changed- forc-plugins/forc-publish
- src
6 files changed
+93
-14
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | | - | |
54 | | - | |
55 | | - | |
| 56 | + | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
61 | 102 | | |
62 | | - | |
| 103 | + | |
| 104 | + | |
63 | 105 | | |
64 | 106 | | |
65 | 107 | | |
| |||
110 | 152 | | |
111 | 153 | | |
112 | 154 | | |
113 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
114 | 162 | | |
115 | 163 | | |
116 | 164 | | |
117 | 165 | | |
118 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
119 | 171 | | |
120 | 172 | | |
121 | 173 | | |
| |||
133 | 185 | | |
134 | 186 | | |
135 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
136 | 191 | | |
137 | 192 | | |
138 | 193 | | |
139 | | - | |
140 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
141 | 197 | | |
142 | 198 | | |
143 | 199 | | |
| |||
151 | 207 | | |
152 | 208 | | |
153 | 209 | | |
154 | | - | |
| 210 | + | |
155 | 211 | | |
156 | 212 | | |
157 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
0 commit comments