Given a function $f:E\subset\mathbb R^n\longrightarrow\mathbb R$ and $x\in E$. The function $$\omega(f,E):=\sup\{|f(x)-f(y)|:x,y\in E\}$$ is called the oscillation of $f$ on $E$, and $$\omega(f,x):=\lim_{\delta\rightarrow0^+}\omega(f,U_\delta(x)\cap E)$$ is called the oscillation of $f$ at $x$.
Assume $E$ is compact and $\omega(f,x)\leq a\ \ \forall x\in E$. Prove that for all $\epsilon>0$, there exists a $\delta=\delta(\epsilon)>0$ such that: $$\omega(f,U_\delta(x)\cap E)\leq a+\epsilon\quad\forall x\in E$$
I think this question is similar to Lebesgue criterion for Riemann-integrability and Heine-Borel Theorem, but I am not sure of the context of that question or what I could take from there.
The furthest I got is arguing that for each $x\in E$ there is a $\delta_x>0$ such that for every $0<\delta\leq\delta_x$ we have $$\omega(f,U_\delta(x)\cap E)\leq \omega(f,x) +\epsilon\leq a+\epsilon\quad\forall x\in E$$ Since $E$ is compact, any open cover of $E$ has a finite subcover: $$\exists\ x_1,\cdots,x_k\in E(k\in\mathbb N^*,k<\infty): E\subseteq\bigcup_{i=1}^k\ U_{\delta_{x_i}}(x_i)$$ The task remains to connect these two observations.