]> source.dussan.org Git - jgit.git/commitdiff
UploadPack: Always make PackWriter.Statistics available 76/32576/1
authorShawn Pearce <sop@google.com>
Fri, 29 Aug 2014 19:56:17 +0000 (12:56 -0700)
committerShawn Pearce <sop@google.com>
Fri, 29 Aug 2014 19:56:17 +0000 (12:56 -0700)
If the packer fails, still obtain the stats and make them available
to the logger and the caller. Failures can frequently happen when
a client disconnects in the middle of a pack stream. Server admins
may still want to examine the timing metrics from counting and
compressing phases.

Change-Id: Iceae4f68b5473f4223d85c9edfb57837fc818eed

org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

index b007f2b513e00d508c2076aaaba4b90b4aab44b7..83806f129a36830e6a7b26fc82c7e82c61b78a57 100644 (file)
@@ -1413,7 +1413,6 @@ public class UploadPack {
                        }
 
                        pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut);
-                       statistics = pw.getStatistics();
 
                        if (msgOut != NullOutputStream.INSTANCE) {
                                String msg = pw.getStatistics().getMessage() + '\n';
@@ -1422,13 +1421,13 @@ public class UploadPack {
                        }
 
                } finally {
+                       statistics = pw.getStatistics();
+                       if (statistics != null)
+                               logger.onPackStatistics(statistics);
                        pw.release();
                }
 
                if (sideband)
                        pckOut.end();
-
-               if (statistics != null)
-                       logger.onPackStatistics(statistics);
        }
 }