home
/
code
/
tt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d54812e
)
Return Option on cache read
author
Siraaj Khandkar
<siraaj@khandkar.net>
Fri, 26 Nov 2021 19:55:02 +0000
(14:55 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Fri, 26 Nov 2021 20:05:19 +0000
(15:05 -0500)
tt.rkt
patch
|
blob
|
blame
|
history
diff --git
a/tt.rkt
b/tt.rkt
index
5b10215
..
2fbcfe2
100644
(file)
--- a/
tt.rkt
+++ b/
tt.rkt
@@
-282,8
+282,7
@@
(define (url->cache-lmod-path uri)
(build-path cache-dir "lmods" (uri-encode (url->string uri))))
(define (url->cache-lmod-path uri)
(build-path cache-dir "lmods" (uri-encode (url->string uri))))
-; TODO Return Option
-(: uri-read-cached (-> Url String))
+(: uri-read-cached (-> Url (Option String)))
(define (uri-read-cached uri)
(define path-v1 (url->cache-file-path-v1 uri))
(define path-v2 (url->cache-file-path-v2 uri))
(define (uri-read-cached uri)
(define path-v1 (url->cache-file-path-v1 uri))
(define path-v2 (url->cache-file-path-v2 uri))
@@
-293,7
+292,7
@@
(file->string path-v2)
(begin
(log-warning "Cache file not found for URI: ~a" (url->string uri))
(file->string path-v2)
(begin
(log-warning "Cache file not found for URI: ~a" (url->string uri))
-
""
)))
+
#f
)))
(: str->url (-> String (Option String)))
(define (str->url s)
(: str->url (-> String (Option String)))
(define (str->url s)
@@
-566,7
+565,10
@@
(define (peer->msgs peer)
(match-define (Peer nick uri _) peer)
(log-info "Reading peer nick:~v uri:~v" nick (url->string uri))
(define (peer->msgs peer)
(match-define (Peer nick uri _) peer)
(log-info "Reading peer nick:~v uri:~v" nick (url->string uri))
- (str->msgs nick uri (uri-read-cached uri)))
+ (define msgs-data (uri-read-cached uri))
+ (if msgs-data
+ (str->msgs nick uri msgs-data)
+ '()))
(: peer-download
(-> Positive-Float Peer
(: peer-download
(-> Positive-Float Peer
This page took
0.029293 seconds
and
4
git commands to generate.