marinara icon indicating copy to clipboard operation
marinara copied to clipboard

sync history across machines

Open surchs opened this issue 6 years ago • 14 comments

Hey,

great app! I work with multiple machines so my history in each is isolated. Could you

  1. sync the history through the google account of the chrome user (if logged in)
  2. tell me where the history data is stored so I can symlink it to a file that is synced between machines?

surchs avatar Aug 15 '17 22:08 surchs

This is an unfortunate situation I figured someone would hit at some point. I don't have a great solution for it.

Chrome has a storage API that I use to store extension-related data. The primary forms of storage are local storage (stays on local machine only) and sync storage (synchronizes across machines, tied to Google account). The actual storage mechanism is abstracted away from the developer. I have no idea how local/sync storage is physically handled.

I use sync storage for settings since they're a small, fixed size. I use local storage for Pomodoros due to storage capacity constraints. Local storage has effectively unlimited capacity, while sync storage has a ~100KB storage capacity (enforced by Chrome). To make it worse, objects are stored as JSON, which is inefficient.

Each Pomodoro completion takes roughly 10 bytes of storage, allowing for about 10K Pomodoros. Assuming someone averages 10 Pomodoros per day, that's under 3 years before they run out of sync storage. That's a long time, but I opted for local storage since it can store infinite Pomodoros and the extension wouldn't just magically fail one day. In addition, there is some demand for taking notes with Pomdoros (#56, #70) which would require yet more storage.

With these constraints, here are some ideas for multi-machine history:

1: Merge history

Marinara currently has the ability to import and export history. To share history across machines, I've thought of adding a "merge history" option. It would merge your existing history with an exported history. This is pretty clunky, though, and would require constant manual shuttling of files between computers.

2: Rolling history (ring buffer)

Use sync storage, but only store the last 100KB worth of Pomodoros. Anything older gets deleted. This is tough from a UI perspective. How would I explain this to users in an obvious way? I think people would get annoyed if history just started disappearing.

3: Integrate 3rd party sync storage

The extension could integrate with Google Drive or Dropbox and could store Pomodoro history there. The problem here is that it ramps up complexity of the extension even more and requires quite a bit more work on my end.

I'm open to other ideas.

schmich avatar Aug 16 '17 09:08 schmich

Interesting, I guess expectations differ somewhat. I'd be perfectly fine with one year of rolling pomodoro storage - and the ability to export them if I want to look back - especially if this means that I don't have to manually export/import my history when I change machines.

Is there maybe a way to combine 1) and 2)? As in: synced storage for about a year, local efference copy for backup (not source of visual representation in app). This would ensure that the local copy of each machine is up to date with other machines (taking care of 3)) and people who jump machines like myself don't need to update things manually.

surchs avatar Aug 28 '17 17:08 surchs

I agree with @surchs in that ~1 year of pomodoro history with the ability to export would be better than manually exporting/importing history.

ryanbuening avatar Oct 16 '17 12:10 ryanbuening

I agree @surchs one year is enough history with ability to export

stevengalvis avatar Nov 16 '17 20:11 stevengalvis

Thanks for the feedback, everyone. This was a bad call on my part and I will be transitioning all storage over to Chrome sync storage.

There will be storage limitation issues, but I will add a simple warning or explanation for users. Hopefully Chrome eventually increases this limit as well.

There are a few other issues in flight before this change, so I'm scheduling this for the next-next release.

schmich avatar Nov 17 '17 06:11 schmich

Have you thought about using something like the Firebase suite?

If users are logged into Chrome with a Google account, then it's easy to get them to sign in to Marinara using Firebase Authentication. The history can be synced using either the Realtime Database or Cloud Firestore.

This would even allow you to easily sync browsers on multiple devices, for active Pomodoros. So a user could start a session on one device and finish it another and could support future apps for Android and/or iOS.

jasonberryman avatar Nov 22 '17 16:11 jasonberryman

@jasonberryman Thanks for the pointer, I hadn't considered it.

At quick glance, with ~50K active weekly users and growing steadily, I would guess this project would need the Flame Plan.

My concern is simply cost and maintenance. I have a number of (much smaller) hobby projects like this, and my rule has become no operational upkeep, just because I don't have the time for it. Right now, Marinara can run on Google's infrastructure ad infinitum for free.

Assuming the Flame Plan is sufficient, $25/mo is not a huge cost, but it's still more than nothing. If I were to get hit by the proverbial bus, the extension would eventually stop working for everyone. I'm being overly dramatic, but I want this project to be in the state such that doing nothing is okay.

Long term, I would like to port this extension to Firefox, and possibly Electron (desktop) and mobile. At that point, using Google's infrastructure will probably no longer be viable, but I haven't done the research.

I do appreciate the suggestion, and I will likely reconsider as the project grows.

schmich avatar Nov 29 '17 22:11 schmich

Hey Chris. Thanks for this great app.

I have the same issue that others mentioned here. Any update on when we might have a solution for syncing history across different machines?

yalaudah avatar Jan 08 '18 19:01 yalaudah

I apologize for the delay here. I recently moved to start a new project and haven't had much spare time to work on Marinara.

I've received a bunch of feedback on this issue, so it is absolutely next on the list. It's just a matter of finding the time to do it. I really don't like making promises on free-time volunteer projects like this, but I do hope to get this working in the next couple of weeks.

schmich avatar Jan 08 '18 21:01 schmich

Another idea for the sync would be to use the sync storage only for histories that differ. You could store a last sync/change timestamp, and everything that differs would end up in the sync storage. Once user is on the second browser/machine the extension could automatically merge the divergent/new history and effectively clear the sync storage. The timestamp would then be reset. This way there are 2 equal histories on both machines with empty sync storage.

It is far less probable that user would use 1 machine for approx. 3 years and still need to merge history. Even if, at this point you could present him with an option to overwrite the history (IMHO 3 years of "divergent" usage means one is not interested in the other history).

I know this is simplistic and might have edge cases but maybe it's worth considering? It might even allow for storing more data as per the PRs you've referenced.

If JSON verboseness is a problem you could always compress data on your side and store them in sync storage as JSON under a single key (flat structure).

Update:

You could even store current "state" (i.e. currently running pomodoro, time remaining etc.) in the sync storage. This would allow users to switch between browsers without any downside. This is what https://github.com/TailorDev/Watson does on the filesystem.

rszalski avatar Feb 13 '18 10:02 rszalski

Still waiting for sync. Up vote! Thank you.

vinhphamh avatar Sep 14 '18 23:09 vinhphamh

The great way to motivate yourself is "don't break the chain" by keeping all days in darker shades of green, it worked amazingly well for me when I had to work from home for couple weeks because of injury. But when I returned to the normal lifestyle with a desktop and a laptop, even though I really like the extension I stopped using it after some time because of too much effort with history exporting/importing. I've tried for some time but..... Thnk you for what you have done so far but please make sync! 1 year would be enough! wechat image_20190118133655

AntonPruss avatar Jan 18 '19 05:01 AntonPruss

@schmich I know it would be more work but I would pay money to have your extension + the ability to sync pomodoros across all devices. That would be an incredibly useful piece of software.

Andrew-Pynch avatar May 12 '20 02:05 Andrew-Pynch

Hi, any update on this issue? What if I want to create a small project which allow my friends to login by their Google accounts and sync their history day by day and make a statistic on that automatically. Thank you!

LeVuMinhHuy avatar Jan 04 '22 00:01 LeVuMinhHuy