Two years for a company that isn't horrendous to work for. If it is clearly not working out - a no brainer - then just leave. Might be on day 1!
That place was a disaster. I mean the half-the-team-ends-up-leaving kinda disaster.
Figuring out when "it's you and not me" takes a lot of introspection and that's usually accompanied by a lot of self doubt. You can't really tell except long after the fact.
Plan continuation bias is hard to overcome though.