xiegeo / commit-sudoku

Accepting pull requests to collectively finish a Sudoku puzzle.
MIT License
41 stars 15 forks source link

The animation ends early #92

Closed MineRobber9000 closed 6 years ago

MineRobber9000 commented 6 years ago

The animation on the front page is only showing commits up to July 29th, even though builds that should've updated it have occurred.

Is it not actually updating Surge? Is GitHub doing caching black magic behind the scenes?

MineRobber9000 commented 6 years ago

So I see that #63 is the reason for why the animations aren't generating... but why was that change introduced?

MineRobber9000 commented 6 years ago

Also, for whatever reason, my output.gif is complete?

xiegeo commented 6 years ago

@MineRobber9000 Merges are excluded because they do not add changes, I proposed it so only the author's name shows up in the animation, not the merger.

Builds on master are reporting successes.

https://travis-ci.org/xiegeo/commit-sudoku/builds/421858440#L673-L689

Creating session GIF...
Created session GIF: /tmp/d5db73c2-0584-459c-88ab-ad01052b5dd5/output.gif
total 1.5M
-rw-r--r-- 1 travis travis 731K Aug 29 02:08 output.gif
drwxr-xr-x 2 travis travis   24 Aug 29 02:08 .
drwxrwxrwt 9 root   root    274 Aug 29 02:08 ..
Uploading GIF to: http://commit-sudoku.surge.sh/output.gif
   Running as [secure] (Student)
        project: /tmp/d5db73c2-0584-459c-88ab-ad01052b5dd5
         domain: commit-sudoku.surge.sh
             IP: 45.55.110.124
   Success! - Published to commit-sudoku.surge.sh

But output.gif only has a size of 730.04 KB (747,566 bytes). Which is smaller than yours 1,007.88 KB (1,032,069 bytes). So the error should be inside the animation script.

@anishkny Any idea what's going on?

xiegeo commented 6 years ago

I think I found the problem, output.gif was uploaded before it finished writing. The gif should have the ending byte 3B, which the uploaded file do not.

https://github.com/eugeneware/gifencoder/blob/f2048f799822ee1dab88e75aa2897bb7c702abd5/lib/GIFEncoder.js#L216-L223

https://github.com/xiegeo/commit-sudoku/blob/281c121820daa00c210b53f5591fa5c6aabf1629/animation/index.js#L57-L66

anishkny commented 6 years ago

Hmm, I am not sure how to poll for GIF done encoded. I took the example directly from here: https://github.com/eugeneware/gifencoder/blob/master/README.md#streaming-api---duplex-piping-with-writes

Let me look into this more.

xiegeo commented 6 years ago

I read up on the stream API, and it looks like "close" event works with https://github.com/xiegeo/commit-sudoku/pull/93

anishkny commented 6 years ago

Fixed by #93