Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*.db file is empty, tables empty #5

Open
tzvsi opened this issue Mar 21, 2020 · 3 comments
Open

*.db file is empty, tables empty #5

tzvsi opened this issue Mar 21, 2020 · 3 comments

Comments

@tzvsi
Copy link

tzvsi commented Mar 21, 2020

Hi. I'm getting an empty SQLite file and empty tables when running default config and/or sack.vfs. Appears the data is in memory, but not writing to SQLite file.. the *.db file doesn't appear to write to disk after put events. When should this persist to disk?

Example:

var vfs = require( "sack.vfs")
var vol = vfs.Volume( "MountName", "vfsFile.dat" )

var gun = Gun({
	file: false,
	db: {
		file: "s1.db",
		exclusive : false
	},
	peers: peers
})

var data = gun.get('data').put({name: 'xyz', age: 41});
var data = gun.get('data').on((val, field)=>{console.log( field,' = ', val );setTimeout( dumpDatabase, 100 )})

function dumpDatabase() {
	var db = vol.Sqlite("s1.db")
	var tables = db.do( "select tbl_name from sqlite_master where type='table'" );
	console.log( "Tables:", tables );
	if (tables.length > 0) {
		var records = db.do("select * from record");
		console.log("records:");
		records.forEach(rec => {
			console.log(`s:${rec.soul} f:${rec.field} v:${rec.value} r:${rec.relation} s:${rec.state}`);
		});
	}
}

Env:

  • node v13.8.0
  • gun v0.2020.301
  • gun-db v1.0.571
@d3x0r
Copy link
Owner

d3x0r commented Mar 22, 2020

I will look into this; perhaps an internal of Gun change.
It should persist on the disk almost immediately.

@d3x0r
Copy link
Owner

d3x0r commented Mar 23, 2020

Hmm, I had some issues getting visual studio 17 to work again (I had uninstalled it end of last year); finally was able to update to the latest gun (2020.301) and, it seems the writes are stalled for some reason; so actually nothing ends up getting any data back in either.
Will look into this in a bit; have a few other projects that are going to distract me first.

@tzvsi
Copy link
Author

tzvsi commented Mar 23, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@d3x0r @tzvsi and others