With short stories, I work on them until I'm pleased with them, when I have the plot complete and pretty tight, when I have the characters going where I want (or where they want, as tends to be the case,) and tied up (or set up) any loose ends. Then I might let it sit for a while and see if it needs more editing. Edit, read, edit, read, so on.
Eventually, I'll hate to read the thing, not because of low quality, but because I don't want to see it anymore. Once I'm happy with it and don't want to read it again, it has become "done."
This may apply to novels, though I haven't gotten furious with those yet, but I'm getting close. The amount of material means it takes a little longer.