summaryrefslogtreecommitdiffstats
path: root/modules/queue
diff options
context:
space:
mode:
Diffstat (limited to 'modules/queue')
-rw-r--r--modules/queue/helper.go7
-rw-r--r--modules/queue/manager.go3
-rw-r--r--modules/queue/queue_bytefifo.go4
-rw-r--r--modules/queue/queue_test.go5
-rw-r--r--modules/queue/setting.go4
5 files changed, 6 insertions, 17 deletions
diff --git a/modules/queue/helper.go b/modules/queue/helper.go
index e0368bce3a..f1aba411a8 100644
--- a/modules/queue/helper.go
+++ b/modules/queue/helper.go
@@ -7,7 +7,7 @@ package queue
import (
"reflect"
- jsoniter "github.com/json-iterator/go"
+ "code.gitea.io/gitea/modules/json"
)
// Mappable represents an interface that can MapTo another interface
@@ -20,8 +20,6 @@ type Mappable interface {
// It will tolerate the cfg being passed as a []byte or string of a json representation of the
// exemplar or the correct type of the exemplar itself
func toConfig(exemplar, cfg interface{}) (interface{}, error) {
- json := jsoniter.ConfigCompatibleWithStandardLibrary
-
// First of all check if we've got the same type as the exemplar - if so it's all fine.
if reflect.TypeOf(cfg).AssignableTo(reflect.TypeOf(exemplar)) {
return cfg, nil
@@ -48,7 +46,6 @@ func toConfig(exemplar, cfg interface{}) (interface{}, error) {
if !ok {
// hmm ... can we marshal it to json?
var err error
-
configBytes, err = json.Marshal(cfg)
ok = err == nil
}
@@ -68,7 +65,6 @@ func toConfig(exemplar, cfg interface{}) (interface{}, error) {
// unmarshalAs will attempt to unmarshal provided bytes as the provided exemplar
func unmarshalAs(bs []byte, exemplar interface{}) (data Data, err error) {
- json := jsoniter.ConfigCompatibleWithStandardLibrary
if exemplar != nil {
t := reflect.TypeOf(exemplar)
n := reflect.New(t)
@@ -78,7 +74,6 @@ func unmarshalAs(bs []byte, exemplar interface{}) (data Data, err error) {
} else {
err = json.Unmarshal(bs, &data)
}
-
return
}
diff --git a/modules/queue/manager.go b/modules/queue/manager.go
index a6d48575ab..a88933191a 100644
--- a/modules/queue/manager.go
+++ b/modules/queue/manager.go
@@ -12,8 +12,8 @@ import (
"sync"
"time"
+ "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
- jsoniter "github.com/json-iterator/go"
)
var manager *Manager
@@ -110,7 +110,6 @@ func (m *Manager) Add(managed interface{},
configuration,
exemplar interface{}) int64 {
- json := jsoniter.ConfigCompatibleWithStandardLibrary
cfg, _ := json.Marshal(configuration)
mq := &ManagedQueue{
Type: t,
diff --git a/modules/queue/queue_bytefifo.go b/modules/queue/queue_bytefifo.go
index 3ea61aad0e..edde47a62d 100644
--- a/modules/queue/queue_bytefifo.go
+++ b/modules/queue/queue_bytefifo.go
@@ -10,8 +10,8 @@ import (
"sync"
"time"
+ "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
- jsoniter "github.com/json-iterator/go"
)
// ByteFIFOQueueConfiguration is the configuration for a ByteFIFOQueue
@@ -83,7 +83,6 @@ func (q *ByteFIFOQueue) PushFunc(data Data, fn func() error) error {
if !assignableTo(data, q.exemplar) {
return fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in %s", data, q.exemplar, q.name)
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
bs, err := json.Marshal(data)
if err != nil {
return err
@@ -309,7 +308,6 @@ func (q *ByteFIFOUniqueQueue) Has(data Data) (bool, error) {
if !assignableTo(data, q.exemplar) {
return false, fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in %s", data, q.exemplar, q.name)
}
- json := jsoniter.ConfigCompatibleWithStandardLibrary
bs, err := json.Marshal(data)
if err != nil {
return false, err
diff --git a/modules/queue/queue_test.go b/modules/queue/queue_test.go
index 89ce23ac4c..65fb816537 100644
--- a/modules/queue/queue_test.go
+++ b/modules/queue/queue_test.go
@@ -7,7 +7,8 @@ package queue
import (
"testing"
- jsoniter "github.com/json-iterator/go"
+ "code.gitea.io/gitea/modules/json"
+
"github.com/stretchr/testify/assert"
)
@@ -29,8 +30,6 @@ func TestToConfig(t *testing.T) {
assert.True(t, ok)
assert.NotEqual(t, cfg2, exemplar)
assert.Equal(t, &cfg, &cfg2)
-
- json := jsoniter.ConfigCompatibleWithStandardLibrary
cfgString, err := json.Marshal(cfg)
assert.NoError(t, err)
diff --git a/modules/queue/setting.go b/modules/queue/setting.go
index 9b2c31b783..0e6ff3a0a8 100644
--- a/modules/queue/setting.go
+++ b/modules/queue/setting.go
@@ -8,9 +8,9 @@ import (
"fmt"
"strings"
+ "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
- jsoniter "github.com/json-iterator/go"
)
func validType(t string) (Type, error) {
@@ -27,8 +27,6 @@ func validType(t string) (Type, error) {
func getQueueSettings(name string) (setting.QueueSettings, []byte) {
q := setting.GetQueueSettings(name)
-
- json := jsoniter.ConfigCompatibleWithStandardLibrary
cfg, err := json.Marshal(q)
if err != nil {
log.Error("Unable to marshall generic options: %v Error: %v", q, err)
stable28'>backport/47832/stable28 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/l10n/fr/files_external.po
blob: 2997ac391373229ab997ec9643d1407284dadefb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295