2 bone IK animation during runtime

Here are two gifs to illustrate :
How it should work (don’t care about the last “jump” to start position)

218980-2017-11-03-15-23-38.gif

How it actually works

218991-2017-11-03-15-24-25.gif