You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The close method marks a File as closed and unfit for further use. We, however, anticipate its implementation to be a noop at the moment.
However, depending on the implementation itself, it might turn out that we want to make some reference counting of some sort to make sure to free the file resources from memory as soon as no VU interacts with it anymore.
prototype
interfaceFile{close()}
example
constfile=fs.openSync("fou.txt")file.close()
The text was updated successfully, but these errors were encountered:
We have discussed this topic heavily with @codebien and concluded that in the current state of k6, introducing this API wouldn't bring outstanding benefits and probably wouldn't lead to a better user experience either.
The current implementation of the fs module does not rely on file descriptors under the hood but rather behaves like a filesystem cache, and the benefit of closing files, for that matter, is not immediately apparent.
We have looked into introducing reference-counted file opening/closing. Still, because we are constrained to opening them in the init context at the moment, the performance benefits we wanted to introduce by doing so are unfortunately canceled.
As a result we decided to put the introduction of this API on hold until we have a good enough reason to do so, both from the technical and/or the user-experience perspective. A good technical reason to introduce it in the future might come as a result of #1079.
As part of #3141, implementing the agreed-upon design for k6's File API, we intend to implement a
File.close
method.The
close
method marks aFile
as closed and unfit for further use. We, however, anticipate its implementation to be a noop at the moment.However, depending on the implementation itself, it might turn out that we want to make some reference counting of some sort to make sure to free the file resources from memory as soon as no VU interacts with it anymore.
prototype
example
The text was updated successfully, but these errors were encountered: