File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed
Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,8 @@ func (self *LocalStore) Put(chunk *Chunk) {
109109 return
110110 }
111111
112- log .Trace ("localstore.put" , "key" , chunk .Addr )
112+ log .Trace ("localstore.put" , "addr" , chunk .Addr )
113+
113114 self .mu .Lock ()
114115 defer self .mu .Unlock ()
115116
@@ -128,28 +129,19 @@ func (self *LocalStore) Put(chunk *Chunk) {
128129 return
129130 }
130131
131- self .memStore .Put (chunk )
132-
133- if memChunk != nil && memChunk .ReqC != nil {
134- close (memChunk .ReqC )
135- }
136-
137132 self .DbStore .Put (chunk )
138133
134+ // chunk is no longer a request, but a chunk with data, so replace it in memStore
139135 newc := NewChunk (chunk .Addr , nil )
140136 newc .SData = chunk .SData
141137 newc .Size = chunk .Size
142- //newc.dbStored = chunk.dbStored
143138 newc .dbStoredC = chunk .dbStoredC
144- //newc.dbStoredMu = chunk.dbStoredMu
145- go func () {
146- <- chunk .dbStoredC
147139
148- self .mu .Lock ()
149- defer self .mu .Unlock ()
140+ self .memStore .Put (newc )
150141
151- self .memStore .Put (newc )
152- }()
142+ if memChunk != nil && memChunk .ReqC != nil {
143+ close (memChunk .ReqC )
144+ }
153145}
154146
155147// Get(chunk *Chunk) looks up a chunk in the local stores
You can’t perform that action at this time.
0 commit comments