Merge pull request #1650 from majewsky/swift/wait-for-dlo-segments
[Swift] wait for DLO segments to show up when Close()ing the writer
This commit is contained in:
commit
03abc6ebae
1 changed files with 7 additions and 0 deletions
|
@ -742,6 +742,9 @@ func (w *writer) Close() error {
|
||||||
if err := w.driver.createManifest(w.path, w.driver.Container+"/"+w.segmentsPath); err != nil {
|
if err := w.driver.createManifest(w.path, w.driver.Container+"/"+w.segmentsPath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := w.waitForSegmentsToShowUp(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.closed = true
|
w.closed = true
|
||||||
|
|
||||||
|
@ -776,10 +779,14 @@ func (w *writer) Commit() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
w.committed = true
|
w.committed = true
|
||||||
|
return w.waitForSegmentsToShowUp()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *writer) waitForSegmentsToShowUp() error {
|
||||||
var err error
|
var err error
|
||||||
waitingTime := readAfterWriteWait
|
waitingTime := readAfterWriteWait
|
||||||
endTime := time.Now().Add(readAfterWriteTimeout)
|
endTime := time.Now().Add(readAfterWriteTimeout)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
var info swift.Object
|
var info swift.Object
|
||||||
if info, _, err = w.driver.Conn.Object(w.driver.Container, w.driver.swiftPath(w.path)); err == nil {
|
if info, _, err = w.driver.Conn.Object(w.driver.Container, w.driver.swiftPath(w.path)); err == nil {
|
||||||
|
|
Loading…
Reference in a new issue