Skip to content

Commit 1bbd16e

Browse files
committed
cycler improvements
- fix cycler caching with empty args - invalidate cache when julia options change - move versionwarning call into juliarc handler
1 parent b64af9d commit 1bbd16e

File tree

6 files changed

+23
-14
lines changed

6 files changed

+23
-14
lines changed

lib/connection/client.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ module.exports =
170170
startupArgs = atom.config.get 'julia-client.juliaOptions.startupArguments'
171171
if startupArgs.length > 0
172172
as = as.concat startupArgs
173+
as = as.map (arg) => arg.trim()
174+
as = as.filter (arg) => arg.length > 0
173175
as
174176

175177
connectedError: (action = 'do that') ->

lib/connection/local.coffee

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ module.exports =
8484
[path, args] = [paths.jlpath(), client.clargs()]
8585
check = paths.getVersion()
8686

87-
args = args.map (arg) => arg.trim()
88-
args = args.filter (arg) => arg.length > 0
89-
9087
if provider is 'Remote'
9188
check = Promise.resolve()
9289
else

lib/connection/process/cycler.coffee

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{isEqual} = require 'underscore-plus'
2+
hash = require 'object-hash'
23
basic = require './basic'
34

45
IPC = require '../ipc'
@@ -11,7 +12,7 @@ module.exports =
1112

1213
procs: {}
1314

14-
key: (path, args) -> [path, args...].join ' '
15+
key: (path, args) -> hash([path, args...].join(' ').trim())
1516

1617
cache: (path, args) -> @procs[@key(path, args)] ?= []
1718

@@ -33,16 +34,17 @@ module.exports =
3334
p.proc
3435

3536
start: (path, args) ->
37+
allArgs = [args, atom.config.get('julia-client.juliaOptions')]
3638
@provider().lock (release) =>
37-
if @cache(path, args).length < @cacheLength
39+
if @cache(path, allArgs).length < @cacheLength
3840
p = @provider().get_(path, args).then (proc) =>
39-
obj = {path, args, proc: proc}
41+
obj = {path, allArgs, proc: proc}
4042
@monitor proc
4143
@warmup obj
42-
@toCache path, args, obj
44+
@toCache path, allArgs, obj
4345
proc.socket
44-
.then => @start path, args
45-
.catch (e) => @removeFromCache path, args, obj
46+
.then => @start path, allArgs
47+
.catch (e) => @removeFromCache path, allArgs, obj
4648
release proc.socket
4749
p.catch (err) =>
4850
release()
@@ -82,7 +84,8 @@ module.exports =
8284
.catch ->
8385

8486
get: (path, args) ->
85-
if (proc = @fromCache path, args) then p = proc
87+
allArgs = [args, atom.config.get('julia-client.juliaOptions')]
88+
if (proc = @fromCache path, allArgs) then p = proc
8689
else p = @provider().get path, args
8790
@start path, args
8891
p

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
"atom": ">=1.39.0 <2.0.0"
2626
},
2727
"dependencies": {
28-
"node-pty-prebuilt-multiarch": "0.9.0",
2928
"atom-package-deps": "*",
3029
"atom-space-pen-views": "^2.0.0",
3130
"etch": "^0.14",
3231
"fuzzaldrin-plus": "^0.6.0",
32+
"node-pty-prebuilt-multiarch": "0.9.0",
33+
"object-hash": "^2.0.3",
3334
"physical-cpu-count": "*",
3435
"semver": "^6.3.0",
3536
"ssh2": "^0.8.4",

script/boot_repl.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ try
5858
Atom.handle("junorc") do path
5959
cd(path)
6060
ispath(junorc) && include(junorc)
61+
62+
if outdated != false
63+
Atom.msg("versionwarning", outdated)
64+
end
6165
nothing
6266
end
6367
Atom.connect(port)
64-
if outdated != false
65-
Atom.msg("versionwarning", outdated)
66-
end
6768
catch
6869
if outdated != false
6970
printstyled("Outdated version of Atom.jl detected.\n", outdated, "\n", color = Base.error_color())

0 commit comments

Comments
 (0)