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

Info: Windows reject speedy #718

Open
tsuyoshicho opened this issue Feb 5, 2020 · 0 comments
Open

Info: Windows reject speedy #718

tsuyoshicho opened this issue Feb 5, 2020 · 0 comments
Assignees

Comments

@tsuyoshicho
Copy link
Contributor

#717 related issue.

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 24 2020 19:52:19)
MS-Windows 64 ビット GUI/コンソール 版 with OLE サポート
適用済パッチ: 1-147

vim-tux x64 on Windows 10

test code

function s:test() abort
  let P = vital#vital#import('Async.Promise')

  " Constants
  let PENDING = 0
  let FULFILLED = 1
  let REJECTED = 2

  " Utilities
  let Wait = {ms -> P.new({res -> timer_start(ms, res)})}
  let p = Wait(200).then({ -> 'resolved' })
  let s = reltime()
  echo p._state ' ' PENDING
  echo P.wait(p, { 'interval': 1000 }) ' ' ['resolved', v:null]
  echo reltimefloat(reltime(s)) * 1000 ' >= ' 1000
  echo reltimefloat(reltime(s)) * 1000 ' <= ' 2000

  let p = Wait(200).then({ -> P.reject('rejected') })
  let s = reltime()
  echo p._state ' ' PENDING
  echo P.wait(p, { 'interval': 1000 }) ' ' [v:null, 'rejected']
  echo reltimefloat(reltime(s)) * 1000 ' >= ' 1000
  echo reltimefloat(reltime(s)) * 1000 ' <= ' 2000
endfunction

call s:test()

result


0   0
['resolved', v:null]   ['resolved', v:null]
1007.9319  >=  1000
1007.9627  <=  2000
0   0
[v:null, 'rejected']   [v:null, 'rejected']
988.8081  >=  1000
988.8189  <=  2000

It waits at least the interval milliseconds (interval > epoch)
let p = Wait(200).then({ -> 'resolved' })
let s = reltime()
Assert Equals(p._state, PENDING)
Assert Equals(P.wait(p, { 'interval': 1000 }), ['resolved', v:null])
Assert Compare(reltimefloat(reltime(s)) * 1000, '>=', 1000)
Assert Compare(reltimefloat(reltime(s)) * 1000, '<=', 2000)
let p = Wait(200).then({ -> P.reject('rejected') })
let s = reltime()
Assert Equals(p._state, PENDING)
Assert Equals(P.wait(p, { 'interval': 1000 }), [v:null, 'rejected'])
Assert Compare(reltimefloat(reltime(s)) * 1000, '>=', 1000)
Assert Compare(reltimefloat(reltime(s)) * 1000, '<=', 2000)
End

My test failed log.
https://github.com/tsuyoshicho/vital.vim/runs/426681919

@tsuyoshicho tsuyoshicho self-assigned this Feb 5, 2020
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

1 participant