summary refs log tree commit diff stats
path: root/svc
diff options
context:
space:
mode:
Diffstat (limited to 'svc')
-rw-r--r--svc/cache.go3
-rw-r--r--svc/db_test.go2
-rw-r--r--svc/init.go2
-rw-r--r--svc/leveldb.go6
-rw-r--r--svc/post.go2
-rw-r--r--svc/sqlite.go6
6 files changed, 0 insertions, 21 deletions
diff --git a/svc/cache.go b/svc/cache.go
index 7bad078..c51478b 100644
--- a/svc/cache.go
+++ b/svc/cache.go
@@ -20,7 +20,6 @@ import (
 // periodically scrape for new users. The remote registries
 // must have been added via POST like a user.
 type RemoteRegistries struct {
-	Mu   sync.RWMutex
 	List []string
 }
 
@@ -59,11 +58,9 @@ func cacheUpdate() {
 	}
 	twtxtCache.Mu.RUnlock()
 
-	remoteRegistries.Mu.RLock()
 	for _, v := range remoteRegistries.List {
 		errLog("Error refreshing local copy of remote registry data: ", twtxtCache.CrawlRemoteRegistry(v))
 	}
-	remoteRegistries.Mu.RUnlock()
 }
 
 // pingAssets checks if the local static assets
diff --git a/svc/db_test.go b/svc/db_test.go
index abf7626..3c0abdf 100644
--- a/svc/db_test.go
+++ b/svc/db_test.go
@@ -23,9 +23,7 @@ func Test_pushpullDatabase(t *testing.T) {
 
 	twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", "", net.ParseIP("127.0.0.1"), statusmap)
 
-	remoteRegistries.Mu.Lock()
 	remoteRegistries.List = append(remoteRegistries.List, "https://twtxt.tilde.institute/api/plain/users")
-	remoteRegistries.Mu.Unlock()
 
 	t.Run("Push to Database", func(t *testing.T) {
 		err := pushDB()
diff --git a/svc/init.go b/svc/init.go
index fe83145..edd081c 100644
--- a/svc/init.go
+++ b/svc/init.go
@@ -5,7 +5,6 @@ import (
 	"log"
 	"os"
 	"os/signal"
-	"sync"
 	"time"
 
 	"github.com/getwtxt/registry"
@@ -47,7 +46,6 @@ var twtxtCache = registry.NewIndex()
 
 // List of other registries submitted to this registry
 var remoteRegistries = &RemoteRegistries{
-	Mu:   sync.RWMutex{},
 	List: make([]string, 0),
 }
 
diff --git a/svc/leveldb.go b/svc/leveldb.go
index 655979a..7446dad 100644
--- a/svc/leveldb.go
+++ b/svc/leveldb.go
@@ -31,11 +31,9 @@ func (lvl *dbLevel) push() error {
 	}
 	twtxtCache.Mu.RUnlock()
 
-	remoteRegistries.Mu.RLock()
 	for k, v := range remoteRegistries.List {
 		dbBasket.Put([]byte("remote*"+string(k)), []byte(v))
 	}
-	remoteRegistries.Mu.RUnlock()
 
 	return lvl.db.Write(dbBasket, nil)
 }
@@ -51,9 +49,7 @@ func (lvl *dbLevel) pull() {
 		field := split[1]
 
 		if urls == "remote" {
-			remoteRegistries.Mu.Lock()
 			remoteRegistries.List = append(remoteRegistries.List, val)
-			remoteRegistries.Mu.Unlock()
 			continue
 		}
 
@@ -90,9 +86,7 @@ func (lvl *dbLevel) pull() {
 		twtxtCache.Mu.Unlock()
 	}
 
-	remoteRegistries.Mu.Lock()
 	remoteRegistries.List = dedupe(remoteRegistries.List)
-	remoteRegistries.Mu.Unlock()
 
 	iter.Release()
 	errLog("Error while pulling DB into registry cache: ", iter.Error())
diff --git a/svc/post.go b/svc/post.go
index 9050859..34ae92f 100644
--- a/svc/post.go
+++ b/svc/post.go
@@ -35,9 +35,7 @@ func apiPostUser(w http.ResponseWriter, r *http.Request) {
 
 	switch remoteRegistry {
 	case true:
-		remoteRegistries.Mu.Lock()
 		remoteRegistries.List = append(remoteRegistries.List, urls)
-		remoteRegistries.Mu.Unlock()
 
 		if err := twtxtCache.CrawlRemoteRegistry(urls); err != nil {
 			errHTTP(w, r, fmt.Errorf("error crawling remote registry: %v", err.Error()), http.StatusInternalServerError)
diff --git a/svc/sqlite.go b/svc/sqlite.go
index dd6d6de..b10e5ae 100644
--- a/svc/sqlite.go
+++ b/svc/sqlite.go
@@ -73,12 +73,10 @@ func (lite *dbSqlite) push() error {
 	}
 	twtxtCache.Mu.RUnlock()
 
-	remoteRegistries.Mu.RLock()
 	for _, e := range remoteRegistries.List {
 		_, err = txst.Exec(e, false, "REMOTE REGISTRY", "NULL")
 		errLog("", err)
 	}
-	remoteRegistries.Mu.RUnlock()
 
 	err = tx.Commit()
 	if err != nil {
@@ -110,9 +108,7 @@ func (lite *dbSqlite) pull() {
 		errLog("", rows.Scan(&uid, &urls, &isUser, &dataKey, &dBlob))
 
 		if !isUser {
-			remoteRegistries.Mu.Lock()
 			remoteRegistries.List = append(remoteRegistries.List, urls)
-			remoteRegistries.Mu.Unlock()
 			continue
 		}
 
@@ -142,7 +138,5 @@ func (lite *dbSqlite) pull() {
 	}
 	twtxtCache.Mu.Unlock()
 
-	remoteRegistries.Mu.Lock()
 	remoteRegistries.List = dedupe(remoteRegistries.List)
-	remoteRegistries.Mu.Unlock()
 }
mp_disp32.cc?h=hlt&id=83c67014034bbf9072d7e4555b0e51e815a95756'>83c67014 ^
4a943d4e ^











fc455c96 ^


0f851e48 ^
50dcc0c1 ^
82a24dfc ^
4a943d4e ^



83c67014 ^
4a943d4e ^











fc455c96 ^

5c26afb1 ^
50dcc0c1 ^
fc455c96 ^
066e01f8 ^
fc455c96 ^




4a943d4e ^



83c67014 ^
4a943d4e ^











fc455c96 ^


0f851e48 ^
94f2de6d ^

82a24dfc ^
4a943d4e ^





83c67014 ^
4a943d4e ^











fc455c96 ^

50dcc0c1 ^

fc455c96 ^
066e01f8 ^
fc455c96 ^



94f2de6d ^







fc455c96 ^
4a943d4e ^





83c67014 ^
4a943d4e ^











fc455c96 ^


0f851e48 ^
94f2de6d ^

82a24dfc ^
4a943d4e ^




83c67014 ^
4a943d4e ^











fc455c96 ^

50dcc0c1 ^

fc455c96 ^
066e01f8 ^
fc455c96 ^



94f2de6d ^







fc455c96 ^
4a943d4e ^




83c67014 ^
4a943d4e ^











fc455c96 ^


0f851e48 ^
94f2de6d ^

82a24dfc ^
4a943d4e ^





83c67014 ^
4a943d4e ^











fc455c96 ^

50dcc0c1 ^

fc455c96 ^
066e01f8 ^
fc455c96 ^



ce27f90f ^
94f2de6d ^






fc455c96 ^
4a943d4e ^





83c67014 ^
4a943d4e ^











fc455c96 ^


0f851e48 ^
94f2de6d ^
469a1a9a ^
82a24dfc ^
4a943d4e ^





83c67014 ^
4a943d4e ^


















83c67014 ^
4a943d4e ^











fc455c96 ^

50dcc0c1 ^

fc455c96 ^
066e01f8 ^
fc455c96 ^



94f2de6d ^







fc455c96 ^
4a943d4e ^





83c67014 ^
4a943d4e ^











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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407