mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 14:54:33 +00:00
shouldCompactOnLaunch is passed the used bytes, not unused bytes
This commit is contained in:
parent
2189feb640
commit
19f04253a7
@ -14,7 +14,7 @@ X.Y.Z Release notes
|
|||||||
`shouldCompactOnLaunch` config property for them.
|
`shouldCompactOnLaunch` config property for them.
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
* None.
|
* Fix incorrect documentation of the `shouldCompactOnLaunch` parameters.
|
||||||
|
|
||||||
### Internals
|
### Internals
|
||||||
* None.
|
* None.
|
||||||
|
@ -324,7 +324,7 @@ class Realm {
|
|||||||
* a Realm for the first time during the life of a process to determine if it should be compacted
|
* a Realm for the first time during the life of a process to determine if it should be compacted
|
||||||
* before being returned to the user. The function takes two arguments:
|
* before being returned to the user. The function takes two arguments:
|
||||||
* - `totalSize` - The total file size (data + free space)
|
* - `totalSize` - The total file size (data + free space)
|
||||||
* - `unusedSize` - The total bytes used by data in the file.
|
* - `usedSize` - The total bytes used by data in the file.
|
||||||
* It returns `true` to indicate that an attempt to compact the file should be made. The compaction
|
* It returns `true` to indicate that an attempt to compact the file should be made. The compaction
|
||||||
* will be skipped if another process is accessing it.
|
* will be skipped if another process is accessing it.
|
||||||
* @property {string} [path={@link Realm.defaultPath}] - The path to the file where the
|
* @property {string} [path={@link Realm.defaultPath}] - The path to the file where the
|
||||||
|
@ -518,10 +518,10 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
FunctionType should_compact_on_launch_function = Value::validated_to_function(ctx, compact_value, "shouldCompactOnLaunch");
|
FunctionType should_compact_on_launch_function = Value::validated_to_function(ctx, compact_value, "shouldCompactOnLaunch");
|
||||||
config.should_compact_on_launch_function = [=](uint64_t total_bytes, uint64_t unused_bytes) {
|
config.should_compact_on_launch_function = [=](uint64_t total_bytes, uint64_t used_bytes) {
|
||||||
ValueType arguments[2] = {
|
ValueType arguments[2] = {
|
||||||
Value::from_number(ctx, total_bytes),
|
Value::from_number(ctx, total_bytes),
|
||||||
Value::from_number(ctx, unused_bytes)
|
Value::from_number(ctx, used_bytes)
|
||||||
};
|
};
|
||||||
|
|
||||||
ValueType should_compact = Function<T>::callback(ctx, should_compact_on_launch_function, this_object, 2, arguments);
|
ValueType should_compact = Function<T>::callback(ctx, should_compact_on_launch_function, this_object, 2, arguments);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user